SwiftUI

Describe your interface once, in Swift, and let it adapt to every Apple platform.

Introduced
2019
WWDC19
Kind
Framework
Runs on
Get it from
iOS
13.0+
iPadOS
13.0+
Mac Catalyst
13.0+
macOS
10.15+
tvOS
13.0+
visionOS
1.0+
watchOS
6.0+
Works in Swift Playground ›
What the code above shows on iPhone, after three taps.

Overview

You declare what the screen should look like for a given state. When the state changes, SwiftUI works out what to redraw. Layout, accessibility, Dark Mode and localization come along by default.

View

A lightweight description of a piece of UI. Compose small views into bigger ones.

@State

Local, view-owned values. Change one and the views that read it update.

@Observable

Share model objects across views; only what reads a property re-renders.

NavigationStack

Data-driven navigation with a path you can push, pop and restore.

ContentView.swift
struct ContentView: View { @State private var count = 0 var body: some View { VStack(spacing: 16) { Text("Tapped \(count) times") .font(.title) Button("Tap") { count += 1 } .buttonStyle(.borderedProminent) } } }

History

How it grew up.

2019

Introduced

Announced at WWDC19 as a declarative way to build UI in Swift.

2020

Full app lifecycle

The App protocol arrives, along with widgets built entirely in SwiftUI.

2022

New navigation

NavigationStack, the Layout protocol and Swift Charts.

2023

Observation

The @Observable macro, plus SwiftData built to pair with it.

2025

Liquid Glass

Apps pick up the new system design language.

Watch and learn