I had a similar question. I've since concluded that my mental model for SwiftUI application development needed to change.
I now create a @StateObject in my @main struct / class. The initializer for this class performs any safe and quick initialization and then dispatches the remaining tasks to a background thread. The object will then publish (see Combine) a completion result. I subscribe to the object in a later view and deal with any failures there.
Essentially, initialization should be though of as a piece of data in the application data model. The application proceeds with creating views and, possibly, interacting with the user until that information is needed. At that point, a progress bar or spinner may be necessary until it is available. Then either present the error to the user, kick off a fallback, or proceed with the application as appropriate.
Post
Replies
Boosts
Views
Activity
The documentation is far less helpful than one would like. Here's what I've found to work so far.
The apple-app-site-association file must reside on a publicly accessible web server with a valid TLS certificate. (see https://jaanus.com/universal-links/).
I specified 'web credentials:mydomain.com?mode=developer' in Associated Domains in the Signing & Capabilities tab in Xcode.
On the iOS device, enable Associated Domains for development. This is found under Settings > Developer > Universal Links: Associated Domains Development
On the Apple Developer website, I have added an identifier for my application with 'Associated Domains' enabled to the Certificates, Identifiers & Profiles list of identifiers.
I've submitted FB13085924 and noted that it likely duplicates the issue in FB13034576.
Add special linker settings to reference Info.plist and define that file.
targets: [
.executableTarget(
name: "MyProgram",
dependencies: [],
linkerSettings: [ .unsafeFlags([
"-Xlinker", "-sectcreate",
"-Xlinker", "__TEXT",
"-Xlinker", "__info_plist",
"-Xlinker", "Sources/Resources/Info.plist"
]) ]
),
]
I'm not sure how to use CREATE_INFOPLIST_SECTION_IN_BINARY with SPM, but I've found that adding linkerSettings to the Platform.swift file works well.
linkerSettings: [
.unsafeFlags([
"-Xlinker", "-sectcreate",
"-Xlinker", "__TEXT",
"-Xlinker", "__info_plist",
"-Xlinker", "Sources/Builder/Info.plist",
])
]
This appears to indicate that too many changes were made to the database without calling ModelContext::save().
I recieved a response on FB13085924: "Investigation complete - Works as currently designed". Not the answer I was hoping to get.