Get the BoxConstraints object in the LayoutBuilder class.

Use the MediaQuery.of() in your build functions
to get the size and orientation of your current app.

To learn more, check out Creating responsive and adaptive apps.

Managing state

In SwiftUI, you use the @State property wrapper to represent the
internal state of a SwiftUI view.

struct

ContentView

View

@State

private

var

counter

var

body

some

View

VStack

Button

"+"

counter

+=

Text

String

counter

))

}}

SwiftUI also includes several options for more complex state
management such as the ObservableObject protocol.