---
title: "SwiftUI: Apple's declarative bet."
date: 2019-11-04
url: https://remiam.co.uk/notes/swiftui-apples-declarative-bet
tags: [Swift, SwiftUI, Apple, iOS]
read_time_minutes: 7
description: "SwiftUI first impressions in late 2019 — Apple finally ships a declarative UI framework. What it gets right, where the rough edges are, and how we are planning around it."
---

# SwiftUI: Apple's declarative bet.

*Published 2019-11-04 · 7 min read · by Liam (Remiam)*

Apple just announced SwiftUI at WWDC. A declarative, cross-platform UI framework for the whole Apple ecosystem. The ambition is huge. The 1.0 is rough — and that's still the right call.

Apple announced SwiftUI at WWDC in June. We've spent the months since then putting it through real client briefs — partly out of curiosity, partly because most of our iOS partners are asking about it. Some real-world thoughts after five months.

## What SwiftUI gets right

- Declarative syntax. UI is a function of state, in the same way React, Vue and Flutter taught us. UIKit's imperative model is finally retired.
- Cross-Apple targets. Same view code can target iOS, iPadOS, macOS, watchOS, tvOS. That's never been a real promise before.
- Live previews in Xcode. Edit the code, see the UI update in real time. Genuinely best-in-class.
- Tight Swift integration. Property wrappers, result builders, opaque return types — features designed to make SwiftUI possible, which now make the rest of Swift better.

## A simple SwiftUI view

```swift ContentView.swift
import SwiftUI

struct ContentView: View {
    @State private var count = 0

    var body: some View {
        VStack(spacing: 20) {
            Text("Tapped \(count) times")
                .font(.largeTitle)
                .fontWeight(.bold)

            Button("Tap me") {
                count += 1
            }
            .padding()
            .background(Color.orange)
            .foregroundColor(.white)
            .cornerRadius(8)
        }
        .padding()
    }
}
```

## Where it's rough in 1.0

- Layouts that UIKit handled with no fuss are still painful. Anything multi-column, anything with cross-cutting alignment.
- Bugs. Real, daily, sometimes show-stopping bugs that require dropping back into UIKit.
- Documentation. Apple's docs for SwiftUI are still much thinner than UIKit's twelve-year archive.
- Backward compatibility — SwiftUI is iOS 13+ only. For client apps that need iOS 11/12 support, we're not picking it yet.

> SwiftUI is the right direction. It's also the most fragile 1.0 Apple has shipped in a long time. We expect SwiftUI 2.0 at WWDC 2020 to be the version that becomes the default.

## How we're planning around it

- New iOS-only client projects with no legacy device support — start in SwiftUI, fall back to UIKit where 1.0 limits bite.
- Existing UIKit codebases — add SwiftUI views one at a time using UIHostingController. Don't rewrite.
- Apple Watch projects — SwiftUI is now the only sensible answer. WatchKit was always painful.
- macOS desktop apps — interesting but premature. AppKit is more mature; we'd wait another year.

SwiftUI is the right direction. It's also the most fragile 1.0 Apple has shipped in a long time. We expect SwiftUI 2.0 at WWDC 2020 to be the version that becomes the default — and from there, UIKit becomes the legacy answer it should have been three years ago.

## References

1. [Apple — SwiftUI documentation](https://developer.apple.com/documentation/swiftui)
2. [SwiftUI by Example — community tutorials](https://www.hackingwithswift.com/quick-start/swiftui)
