I'm experiencing a really strange crash, so I spent some time making the absolute minimal reproduction possible, and I'm hoping someone can look into it.
(The reproduction repo is here, but note that you need to switch to the test-available
branch to test the crash)
Suppose I have some multi-platform SwiftUI code, and I want to conditionally add a view modifier for platforms that support an api. Here's some code that calls out to fullScreenCover(isPresented:onDismiss:content:)
, which is not available at all for macOS:
public extension View {
@available(iOS 14, tvOS 14, watchOS 7, *)
@available(macOS, unavailable) // <-- NB: guard macOS 👍
func myModifier() -> some View {
self.fullScreenCover(isPresented: .constant(true)) {
Text("Hello fullscreen cover!")
}
}
}
Take note that the function is guarded with an @available(macOS, unavailable)
atttribute.
Now, with this code in my project, without even CALLING that function anywhere, I'm immediately getting a crash on macOS 10.15 Catalina, for a missing symbol. The core line of the crash is below, and if helpful, the entire crash report is here.
Symbol not found: _$s7SwiftUI4ViewPAAE15fullScreenCover11isPresented9onDismiss7contentQrAA7BindingVySbG_yycSgqd__yctAaBRd__lFQOMQ
This shouldn't be, right? That code path should never be taken on 10.15, if I'm understanding correctly? Is this a bug? Is there some sort of alternative compiler directive that would prevent this crash?
Again, I have a super simple git repo reproducing this crash, just checkout the test-available
branch, archive, sign, and it will crash on Catalina.
Any help would be greatly appreciated! 🙏