Skip to content
Commitwise
Menu

View modifier

Also called: Modifier

A method like .padding() or .background() in SwiftUI that wraps a view in a new view with a changed look or behavior.

Definition

Each modifier returns a new view that contains the previous one, so a chain of modifiers is applied from the inside out and its order changes the result. Some modifiers change layout, some draw, and some set environment values like the font that flow down to every child view. Jetpack Compose has the same idea in its Modifier chain, read from the outside in.

In practice

Text("Go").padding().background(.blue) paints the padding blue; Text("Go").background(.blue).padding() does not.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.