I've had this issue as well -- but mostly only noticeable when I deploy to device. I get UI lag as the share sheet opens (no matter what kind of share source I add).
let activityController = UIActivityViewController(activityItems: items, applicationActivities: []) UIApplication.shared.currentUIWindow()?.rootViewController!.present(activityController, animated: true)
.. though I'm also doing invoking the share sheet in a different way within my view model.
Post
Replies
Boosts
Views
Activity
Thanks both, the MainActor.assumeIsolated worked for me such I can still use the new #Preview macro, too.
I believe this is a bug in iOS 18 or Xcode beta. I am seeing it a lot too in an app that I was testing in the new beta. Hadn't noticed the error before and I can see nothing wrong in the way I'm using views, SwiftData query objects etc.