A 2nd-generation Xcode project template with design patterns for developing apps on Apple-based platforms using Swift
Minimum os target versions are iOS 12, macOS 13, and tvOS 12, and watchOS 4
While Apple has provided some excellent new capabilities in the latest OS's, often you need to support an app across several OS versions, or even multiple platforms. This is where Resolve and CoreResolve come in to help. It provides a consistent experience regardless of the OS version or platform.
Emphasis is on as few modules as possible, and using platform-agnostic naming to avoid unnecessary code fragmentation
To that end, Target Memberships are the preferred mechanism to share code across platforms (iOS, macOS, tvOS, watchOS).
The main components are as follows:
- CoreResolve: Swift Package with app-agnostic core interfaces and classes
- Resolve: app code containing apps, frameworks, and extensions
- Should be renamed to the App name (you may duplicate and rename if you wish to build a suite of apps)
- 4 app targets + any extensions
- 4 framework "ResolveKit" targets + 3 test targets
Resolve's naming conventions match the conventions of CoreResolve:
- Service: A protocol declaring some service for use by an app and its extensions
- Manager: A concrete implementation of a Service
- Configuration: A common constructor parameter for Managers, which allows them to be app and platform agnostic as much as possible
In the BuildSettings for the Resolve project is a User Defined setting called RESOLVE_BUNDLE_PREFIX
. Change this to reflect the base bundle identifier that you need (e.g. com.yourcompany
). The default prefix of com.$(DEVELOPMENT_TEAM).template
, while useful for samples, is not needed.
You should also use Xcode to refactor the name Project name to the name of your app, which will cascade changes to the targets as well. Assistance with this effort is possible through Sponsorships.
CloudKit running in developer mode will configure itself for nearly all of its requirements, with few exceptions. The following manual interventions will be needed:
- Go to the CoreData screen and tap the + button to add a single
SharedEvent
record (to initialize the schema on the remote end) - Log onto the CloudKit Dashboard and visit the schema page of your app's Development container
- Go to the
SharedEvent
schema in the CloudKit Dashboard and ensure the system fieldcreatedAt
is queryable - Go to the
SharedEvent
schema in the CloudKit Dashboard and ensure the system fieldcreatedBy
is queryable - Go to the CloudKit screen and tap the + button, search for and add yourself as a "friend"
- Any other iCloud accounts who performed steps 1-5 can now be added as a friend, and your phone will be notified whenever they create new SharedEvents
- Q: I'm creating a new file. Where should it go?
- A: Use the following guidelines:
- If it can only be used by a specific app, even across platforms, it goes in the app-specific "Resolve" target (or whatever the name of the app is)
- If it can be used by a specific app AND one or more of its extensions, it goes in the "ResolveKit" targets
- As always, use Target Membership to provide access to multiple platforms