0Pricing
Swift Academy · Lesson

The View Protocol and Body Property

What makes a SwiftUI View and how body defines the UI hierarchy.

Welcome

SwiftUI is a declarative UI framework. Every visual element is a `View` — a lightweight value type whose `body` property describes the UI.

The View Protocol

```swift protocol View { associatedtype Body: View; var body: Body { get } } ``` Conforming to `View` requires a `body` computed property that returns some other `View`.

All lessons in this course

  1. The View Protocol and Body Property
  2. @State: Local Mutable State in Views
  3. View Modifiers: Chaining and Custom Modifiers
  4. Previews and the Preview Provider
← Back to Swift Academy