20.1 · Shared cores, platform conditions, capabilities, and the release train
The same Swift runs on a phone, a tablet, a computer, a TV, a watch and a headset, but the product, input, process and power model differ on each. Multiplatform work is mostly deciding what to share and what to let differ.
Mental model. Share the core, vary the leaves. Models, networking, storage and business rules are common; navigation, input and presentation belong to each platform.
Sharing safely
Platform conditions, availability, and the shape of a shared codebase.
- How do you structure one codebase for several Apple platforms: shared cores, UI leaves, #if os, canImport and @available?
The workable shape is a shared core with thin platform leaves. The core (domain models, business rules, networking and persistence, view models, formatting… - How do the platforms differ in input, process model and capabilities, and which entitlements and APIs change per platform?
Think of each platform as a different device contract. iPhone and iPad: touch (plus pointer, keyboard and Pencil on iPad), a foreground app with background…
Shipping it
One core, several UI leaves, one release train.
- How do you run one shared core with several UI leaves on a single release train?
Shipping an iPhone app, an iPad layout, a Mac app, an Apple TV app and a watch app from one team is an organisation and release problem at least as much as a…
More in Multiplatform Apple
- 20.2 · Documents, scenes and windows on iPad
- 20.3 · Catalyst, native AppKit and SwiftUI on the Mac, and the Mac’s sandbox and menus
- 20.4 · The focus engine, the remote and the 10-foot UI, and media-first apps
- 20.5 · Input and battery, on-watch health and networking, and the dual-target setup
- 20.6 · Windows, volumes and immersive spaces
- 20.7 · What the compiler and the runtime say about each platform
- 20.8 · The Mac sandbox, signing, bookmarks, menus and Catalyst, measured
- 20.9 · Which scenes, modifiers and spaces exist where, and how a package declares them