Post

Replies

Boosts

Views

Activity

Reply to swift_getOpaqueTypeMetadata crash when using availability check in SwiftUI running on iOS 14
I managed to fix this crash by using custom ViewModifier public extension View {   @ViewBuilder   func searchableFor15(text: Binding<String>) -> some View {     if #available(iOS 15, *) {         self .modifier(SearchModifier(text: text))     } else {         self .modifier(NoSearchModifier())     }   } } @available(iOS 15, *) private struct SearchModifier: ViewModifier {     let text: Binding<String>     func body(content: Content) -> some View {         content .searchable(text: text)     } } private struct NoSearchModifier: ViewModifier { func body(content: Content) -> some View {         content     } }
Dec ’21