Reputation: 4833
I made a compatibility version of .contentTransition
like this:
public struct ContentTransitionNumericText: ViewModifier {
public func body(content: Content) -> some View {
if #available(iOS 16.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, macOS 13.0, *) {
content
.contentTransition(.numericText())
} else {
content
}
}
}
public extension View {
func contentTransitionNumericText() -> some View {
modifier(ContentTransitionNumericText())
}
}
However, running this on iOS 15 (with Xcode 14 beta) causes the app to crash with Symbol not found: _$s7SwiftUI17ContentTransitionVMn
error. It seems that the availability check is completely ignored.
Is there a known solution to this?
EDIT: Seems like a Xcode/Swift bug, reported as FB11143522
EDIT2: The workaround from https://swiftui-lab.com/bug-os-check/ doesn't help inside ViewModifier, still crashes.
Upvotes: 4
Views: 2366
Reputation: 11
I found similar case in xcode 14's release note https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes
search for "Link Binary With Libraries"
Workaround: For each target using a StoreKit API listed above, navigate to the “Build Phases” tab in the project editor with the target selected and add StoreKit.framework under “Link Binary With Libraries” if it isn’t already present. Set the “Status” column to “Optional.”
and for ContentTransition just add SwiftUI.framework
I tried and worked.
Upvotes: 1