Post

Replies

Boosts

Views

Activity

Reply to iOS 18 changes the order of Document-based SwiftUI document reading and view loading?
I'm seeing similar issues, but with the basic FileDocument. It works, but now seems to be initialized on a background thread. This gives me a "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates." error. This even happens with Apple's own FileDocument-based template project. Wrapping the "self." mutation in DispatchQueue.main.async doesn't help, because then it complains the escaping closure is capturing a mutating "self" parameter (and also assumes self is uninitialized at the end, because the mutation is deferred).
Sep ’24