---
title: "modifier(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/modifier(_:)"
---

# modifier(_:)

Applies a modifier to a view and returns a new view.

## Declaration

```swift
nonisolated func modifier<T>(_ modifier: T) -> ModifiedContent<Self, T>
```

## Parameters

- `modifier`: The modifier to apply to this view.

## Mentioned in

Reducing view modifier maintenance

## Discussion

Discussion Use this modifier to combine a View and a ViewModifier, to create a new view. For example, if you create a view modifier for a new kind of caption with blue text surrounded by a rounded rectangle: struct BorderedCaption: ViewModifier {     func body(content: Content) -> some View {         content             .font(.caption2)             .padding(10)             .overlay(                 RoundedRectangle(cornerRadius: 15)                     .stroke(lineWidth: 1)             )             .foregroundColor(Color.blue)     } } You can use modifier(_:) to extend View to create new modifier for applying the BorderedCaption defined above: extension View {     func borderedCaption() -> some View {         modifier(BorderedCaption())     } } Then you can apply the bordered caption to any view: Image(systemName: "bus")     .resizable()     .frame(width:50, height:50) Text("Downtown Bus")     .borderedCaption()

## See Also

### Modifying a view

- [Configuring views](swiftui/configuring-views.md)
- [Reducing view modifier maintenance](swiftui/reducing-view-modifier-maintenance.md)
- [ViewModifier](swiftui/viewmodifier.md)
- [EmptyModifier](swiftui/emptymodifier.md)
- [ModifiedContent](swiftui/modifiedcontent.md)
- [EnvironmentalModifier](swiftui/environmentalmodifier.md)
- [ManipulableModifier](swiftui/manipulablemodifier.md)
- [ManipulableResponderModifier](swiftui/manipulablerespondermodifier.md)
- [ManipulableTransformBindingModifier](swiftui/manipulabletransformbindingmodifier.md)
- [ManipulationGeometryModifier](swiftui/manipulationgeometrymodifier.md)
- [ManipulationGestureModifier](swiftui/manipulationgesturemodifier.md)
- [ManipulationUsingGestureStateModifier](swiftui/manipulationusinggesturestatemodifier.md)
- [Manipulable](swiftui/manipulable.md)
