Setting up Xcode for modularization

Written for Xcode 15.2 Create the multiplatform app Start Xcode and go to File➡️New Project (⇧⌘N) Select the Multiplatform App template and click Next: Set the options for the new project and click Next. We’ll be using DemoProductName to see how Xcode uses this name. For example, note how it’s automatically appended to the organization identifier, generating the bundle identifier: Save the project on the disk. At this point, Xcode has created a DemoProductName scheme which can build the app for iOS or MacOS....

Tip #1: Implicit Optional Initialization

An optional var defaults to nil (p1), but not when its type is Optional (like p3) struct Demo { var p1: String? // defaults to `nil` let p2: String? // compiler error var p3: Optional<String> // compiler error let p4: Optional<String> // compiler error } Source

Tip #2: Development Assets

The default Xcode template contains a Preview Content folder, ideal for placing assets only used in previews and mocking data for tests. This works thanks to DEVELOPMENT_ASSET_PATHS (reference), a build setting defining files and directories excluded from archive and install builds.

Tip #3: Editorial guidelines for Apple

Apple maintains a style guide providing guidelines to help maintain a consistent voice in Apple materials, including documentation, reference materials, training, and user interfaces. via

Tip #4: TTS using Personal Voice

Since iOS 17, AVSpeechSynthesizer can use a Personal Voice, a synthesized voice that sounds like your own. via