·7 min read·

SwiftUI: Apple's declarative bet.

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

  • 01Declarative syntax. UI is a function of state, in the same way React, Vue and Flutter taught us. UIKit's imperative model is finally retired.
  • 02Cross-Apple targets. Same view code can target iOS, iPadOS, macOS, watchOS, tvOS. That's never been a real promise before.
  • 03Live previews in Xcode. Edit the code, see the UI update in real time. Genuinely best-in-class.
  • 04Tight 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

ContentView.swiftswift
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

  • 01Layouts that UIKit handled with no fuss are still painful. Anything multi-column, anything with cross-cutting alignment.
  • 02Bugs. Real, daily, sometimes show-stopping bugs that require dropping back into UIKit.
  • 03Documentation. Apple's docs for SwiftUI are still much thinner than UIKit's twelve-year archive.
  • 04Backward 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

  • 01New iOS-only client projects with no legacy device support — start in SwiftUI, fall back to UIKit where 1.0 limits bite.
  • 02Existing UIKit codebases — add SwiftUI views one at a time using UIHostingController. Don't rewrite.
  • 03Apple Watch projects — SwiftUI is now the only sensible answer. WatchKit was always painful.
  • 04macOS 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.

Talk to Remiam about a system like this.