Apple's modern declarative framework for building user interfaces across all Apple platforms. SwiftUI uses Swift's power to provide a simple, intuitive way to build complex UIs with less code.
of iOS users worldwide can use SwiftUI (iOS 13+ required)
| iOS Version | Market Share | Status |
|---|---|---|
| iOS 18.7 | 30.3% | Supported |
| iOS 18.6 | 29.8% | Supported |
| iOS 26.1 | 10.7% | Supported |
| iOS 18.5 | 6.0% | Supported |
| iOS 16.7 | 2.3% | Supported |
| iOS 26.2 | 2.0% | Supported |
| iOS 18.3 | 1.8% | Supported |
| iOS 15.8 | 1.8% | Supported |
| iOS 17.6 | 1.7% | Supported |
| iOS 26.0 | 1.3% | Supported |
Declarative Swift syntax
Automatic support for Dark Mode
Live preview in Xcode
Cross-platform (iOS, macOS, watchOS, tvOS)
Built-in animations and transitions
Automatic accessibility support
Create a simple SwiftUI view
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Hello, SwiftUI!")
.font(.title)
.foregroundColor(.blue)
Button("Tap Me") {
print("Button tapped")
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}Use @State for reactive UI updates
import SwiftUI
struct CounterView: View {
@State private var count = 0
var body: some View {
VStack(spacing: 20) {
Text("Count: \(count)")
.font(.largeTitle)
HStack {
Button("-") {
count -= 1
}
.buttonStyle(.bordered)
Button("+") {
count += 1
}
.buttonStyle(.bordered)
}
}
.padding()
}
}Create a list with navigation links
import SwiftUI
struct Item: Identifiable {
let id = UUID()
let name: String
}
struct ListView: View {
let items = [
Item(name: "Item 1"),
Item(name: "Item 2"),
Item(name: "Item 3")
]
var body: some View {
NavigationStack {
List(items) { item in
NavigationLink(item.name) {
Text("Detail for \(item.name)")
}
}
.navigationTitle("Items")
}
}
}Apple's modern declarative framework for building user interfaces across all Apple platforms. SwiftUI uses Swift's power to provide a simple, intuitive way to build complex UIs with less code.
SwiftUI is available on iOS 13 and later. Currently, 97.2% of iOS users worldwide can use this framework.
Related frameworks include Combine, Widgetkit. Each has different capabilities and iOS version requirements.