I'm on macOS Monterey 12.4 (Apple Silicon) with TSAN enabled on Xcode 13.2.1, the issue repros on my iOS 14.4 Simulator - switching to an iOS 15.2 Sim works for me.
Post
Replies
Boosts
Views
Activity
I was able to solve my issue by clicking on the xcodeproj file, selecting the app target, and ensuring that all required frameworks/etc were added as "Embed & Sign" under "Frameworks, Libraries, and Embedded Content"
I'm going to see if this is fixed in Xcode 12.3. The gist that @steipete linked to fixed another (slightly unrelated) issue I was having, which was an infinite layout crash that I was seeing on xcode 12.1 on iOS14 (only on notched devices): Pin UIHostingController's view to the edges of a parent UIView
Translate that parent UIView to be partially below the screen
Resize the SwiftUI content to be a larger size than it was originally
You'll get an infinite layoutSubviews crash without that slightly terrible gist. SwiftUI can't seem to handle having partially off-screen content when safeAreas are in the mix.
There's something about SwiftUI's layout system that tries to automatically avoid those areas of the screen which causes lots of issues.
Hey, I was able to get this working by importing Combine in the file that declared the public ObservableObject - no NSObject subclassing needed. Once I did this and added a public init... it worked! Give it a shot.
Just a note on subclassing NSObject, I'd avoid it, although my framework compiled fine with it, it failed to compile properly when I had another app pull in that framework.