Skip to content
BENIBIX Learn

SwiftUI

Development📱 Mobile DevelopmentMobile Frameworks

Also known as Swift UI

Apple's way to build app screens in Swift. You say what to show.

Think of it like

Think of it like a shopping list. You write what you want, and the store finds where it is.

Example

Emma writes a list of her notes in SwiftUI. When she adds a note, the list updates by itself.

Why it matters

It is the modern way to build native Apple apps. Screens take far less code than the older way.

Definition

SwiftUI is Apple's way to build screens for its devices in the Swift language. You describe what the screen should show, not each step to draw it. When the data changes, SwiftUI redraws the parts that changed. It works for iPhone, iPad, Mac and Apple Watch apps. It runs only on Apple's systems.

Example code

swift
struct ContentView: View {
    var body: some View {
        Button("Say hi") { print("Hi") }
    }
}
A SwiftUI screen with one button. You say what to show, and SwiftUI draws it.
The SwiftUI row: Swift in, and iOS draws its own button.

Common mistake

Expecting it to build Android apps. SwiftUI is for Apple's systems only.

Key takeaways

  1. 1
    Say what, not how. You describe the screen, not the steps.
  2. 2
    Updates itself. A change in data redraws the screen.
  3. 3
    Apple only. It builds apps for Apple's devices.