I always build for every Apple UI framework: SwiftUI, AppKit and UIKit, on Mac, iPhone and iPad. A feature is not finished when it works in one of them: it has to work in every app that uses it. That is what I mean by universal Apple development.
The short version: one Xcode project at the root with no workspace, a thin app for every platform and UI framework, and one local package where each feature is a target. There is a template for it, ready to download.
Download the template here
What working this way demands
A project with both interfaces has six apps, and they can easily become six places to write the same thing. I avoid that with three rules.
App targets stay thin. They start the app and load
AppFeature.Features live in one local package, each as its own target, with its own sources and tests.
Each app links only what it uses, and a feature has to work wherever it is linked.
This is how thin they are, from a project the template generates. The Mac app in SwiftUI:
import AppFeature
import SidebarFeature
import SwiftUI
@main
struct MainApp: App {
var body: some Scene {
WindowGroup {
AppFeature.Screen.RootView {
SidebarFeature.Screen.Panel()
}
}
}
}
The iPad app differs only in what it links:
import AppFeature
import CaptureFeature
import SidebarFeature
import SwiftUI
@main
struct MainApp: App {
var body: some Scene {
WindowGroup {
AppFeature.Screen.RootView {
SidebarFeature.Screen.Panel()
CaptureFeature.Screen.Panel()
}
}
}
}
The scene delegate of the iPhone app in UIKit (its app delegate only names this class):
import AppFeature
import CaptureFeature
import UIKit
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
let window = UIWindow(windowScene: windowScene)
window.rootViewController = AppFeature.Screen.ViewController(sections: [CaptureFeature.Screen.ViewController()])
window.makeKeyAndVisible()
self.window = window
}
}
And the Mac app in AppKit:
import AppFeature
import AppKit
import SidebarFeature
@main
final class AppDelegate: NSObject, NSApplicationDelegate {
private var window: NSWindow?
static func main() {
let application = NSApplication.shared
let delegate = AppDelegate()
application.delegate = delegate
application.setActivationPolicy(.regular)
application.run()
}
func applicationDidFinishLaunching(_: Notification) {
NSApp.mainMenu = AppFeature.Menu.Bar.make()
let root = AppFeature.Screen.ViewController(sections: [SidebarFeature.Screen.ViewController()])
let window = NSWindow(contentViewController: root)
window.makeKeyAndOrderFront(nil)
self.window = window
NSApp.activate()
}
func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool {
true
}
}
One model, native in each framework
Every framework does not mean one layout everywhere. I optimize the interface for the person using it, through the native presentation of each platform, not for the convenience of one shared layout. Sameness across platforms is not a goal in itself, so two versions may differ where the platforms do.
In my deepest example of this, an animation library, each feature is split into targets inside the one package:
A model of plain values that imports no UI framework.
A Core Animation layer target, shared by the UIKit and AppKit versions.
A target for each framework: UIKit for iPhone and iPad, AppKit for the Mac, and SwiftUI, which takes only the model and hosts no platform view.
No version depends on another. Each one gets its own small demo app, all in one project.
Building for all of them is not the same as having seen all of them work. swift test covers the Mac, the iOS-only code is mostly compiled for the Simulator without being run, and I have UI scenarios for very little of it so far.
The layout in a project
This is a project with both interfaces and the demo features switched on. With one interface there are three apps, and without the demo features there is no SidebarFeature or CaptureFeature.
Shop/
Shop.xcodeproj the one project, the file you open
Apps/
MacSwiftUI/ thin app targets
PhoneSwiftUI/
PadSwiftUI/
MacAppKit/
PhoneUIKit/
PadUIKit/
...UITests/ one UI test folder per app
Packages/
Package.swift the one manifest
Sources/
AppFeature/
AppSettings/
SidebarFeature/
CaptureFeature/
Tests/
On disk the folder is Packages/. Xcode shows it under the package’s name, AppPackage.
Package tests run from the one package, and apps build from the project:
swift test --package-path Packages
xcodebuild -project Shop.xcodeproj -scheme MacSwiftUI \
-configuration Debug -destination 'platform=macOS' build
swift test runs on the Mac, so code that exists only for UIKit or iOS is not tested by it.
The template
You can use this layout without setting it up by hand. The template is called App with a Local Package, it is MIT licensed, and it makes thin apps for Mac, iPhone and iPad with one local package. Apple Watch, Apple TV and Apple Vision Pro are not in it.
Get it here: codeberg.org/Mihaela/PackagesAppTemplate
Install it:
git clone https://codeberg.org/Mihaela/PackagesAppTemplate.git
cd PackagesAppTemplate
swift Install.swift
Then choose File, New, Project in Xcode and select macOS, where the template is listed even though it also makes the iPhone and iPad apps. Under My Templates, choose App with a Local Package. If it does not show, quit Xcode and open it again.

To update after downloading a newer version, run swift Install.swift --replace. To remove it, run swift Install.swift --uninstall.
Every generated project is a small table and detail app, and depends on a package from GitHub, Apple’s swift-algorithms, to show that a remote package sits happily beside the local one.
With the demo features on, the screens differ on purpose, because each app links only what it uses: the Mac apps take SidebarFeature, the iPhone apps take CaptureFeature, and the iPad apps take both.
On the Mac, here in AppKit, the list sits in a sidebar with the detail beside it. The last line of the detail comes from SidebarFeature.

On the iPhone, here in SwiftUI, the same app opens on the list, because there is no room for both. Tapping a row opens its detail.

On the iPad, again in SwiftUI, list and detail are side by side. This app links both demo features, so both of their lines appear. I tapped the iPad row to show them.

Beside Xcode’s usual fields, the template asks three questions:

The menu holds three choices, and each box is simply on or off:
| Question | Choices |
|---|---|
| Interface | SwiftUI, UIKit and AppKit, Both |
| Include demo features | off, on |
| Add GitHub Actions workflow | off, on |
That makes 3 x 2 x 2 = 12 different projects. Product Name, Team and Organization Identifier are not counted: they change names and signing, not what is generated. Here they are, with example names:
| # | Project | Interface | Include demo features | Add GitHub Actions workflow | Apps |
|---|---|---|---|---|---|
| 1 | ShopSwiftUI | SwiftUI | off | off | 3 |
| 2 | ShopSwiftUIFeatures | SwiftUI | on | off | 3 |
| 3 | ShopSwiftUICI | SwiftUI | off | on | 3 |
| 4 | ShopSwiftUIFeaturesCI | SwiftUI | on | on | 3 |
| 5 | ShopNative | UIKit and AppKit | off | off | 3 |
| 6 | ShopNativeFeatures | UIKit and AppKit | on | off | 3 |
| 7 | ShopNativeCI | UIKit and AppKit | off | on | 3 |
| 8 | ShopNativeFeaturesCI | UIKit and AppKit | on | on | 3 |
| 9 | ShopBoth | Both | off | off | 6 |
| 10 | ShopBothFeatures | Both | on | off | 6 |
| 11 | ShopBothCI | Both | off | on | 6 |
| 12 | ShopBothFeaturesCI | Both | on | on | 6 |
Here is the largest of them, ShopBothFeatures, open in Xcode: six apps and their UI test folders at the top, then the one package with its targets, and below it the dependencies from GitHub. The file on the right is the SwiftUI root view that the SwiftUI apps share.

All twelve are in the repository’s Projects/ folder, so you can look before installing anything. With Xcode 27.2, all of them build, 48 apps in total, and their package tests pass. What I have not tried: creating a project from the New dialog, running the GitHub workflow, running the UI tests, and older Xcode versions.
Why I said goodbye to the workspace
My layout used to start with a workspace: one window over the app projects, the Swift packages and the documents. Then I started working on an app about Xcode templates, and I met the obstacle. When you choose File, New, Project, the dialog ends in a project. It does not leave you in an open workspace. What remains is a manual step or a workaround, and the ones I could think of were ugly and cumbersome.
So I asked what the workspace was giving me. It showed everything in one window, it listed the documents, and in some projects it was the only link between an app and its package: the app linked the package’s products without holding a reference to the package. Take the workspace away from a project like that and Xcode reports Missing package product. A single project can hold the reference itself, which Apple documents as organizing your code with local packages.
I did not want to decide this from memory. In a small trial with Xcode 27.2, a plain project template produced a project, two app targets, a UI test bundle and a local package beside the project, with no workspace.
One warning: a project I put together without a template passed its command line build and then failed on Run, with Unable to resolve module dependency, because ONLY_ACTIVE_ARCH was missing in Debug. Check with the Run button, not only the command line.
What it costs
One project file for everything. Every new app edits the same file.
No project per app, if you liked each app having its own.
One dependency list. Linking only what an app uses does not shorten it: every app still resolves all of the package’s dependencies, and so does anyone else who uses the package.
Unique target names. A target cannot share its name with a target in any package you depend on, or resolution fails.
Access levels. When you split features into targets, what was
internaland is now used across them must becomepackage, and memberwise initializers have to be written out.
I have not compared indexing speed, or how the project file behaves when two people merge changes to it.
The app that led me here
I have been interested in templates for a long time. Working this way is one of the reasons I am now building an app for them: when every project needs the same set of targets, I want the template to do that work.
I originally meant to write about how to create Xcode templates. Then I decided that it is far too complicated to explain, so I am building an app instead.
Even this small template surprised me: documentation is scarce, and when something is wrong, Xcode often says nothing until you build.
The app creates templates visually. It is still in development, so there is nothing to download yet.
It has an editor for the template source, with a template library, an outline, diagnostics and a diagram of the whole template. Here it has Apple’s Cocoa Touch Class template open.

The app did not make the template in this post; that one comes from a small Swift generator. If you want to hear when there is something to try, Apple UI Insider, my free newsletter, is where I will say so.
The picture at the top of this post was drawn by a Swift program of about 245 lines with my own drawing library, PureDraw. It draws only shapes: a gradient background, rounded rectangles, ellipses, polygons, curves and shadows. PureDraw rasterizes them and writes the PNG. No image generator or outside drawing tool was used, and no pixel was edited by hand.
