The following app builds, but causes a runtime crash when trying to execute on an iOS 14.7 device. Using Xcode 13b5, macOS Monterey b5, iOS 15.b6 & iOS 14.7
import SwiftUI
struct ContentView: View {
@State private var text = "This app causes a runtime error on ios 14.7"
@available(iOS 15.0, *)
@FocusState var isInputActive: Bool
var body: some View {
if #available(iOS 15.0, *) {
TextEditor(text: $text)
.focused($isInputActive)
} else { // ios14 or <
TextEditor(text: $text)
}
}
}
Am I missing something in the above program listing?
This is such a fundamental basic requirement - to wrap @FocusState with @available(iOS 15) and then later in the code check #available(iOS 15) - that it's hard to believe that it is a bug. The more likely answer is that I'm not using these compiler directives correctly...
Any thoughts? Any help?
Where you able to find a solution? I get the same crash using
if #available(iOS 15.0, *) {
on Xcode 13.I have the same problem :( I have a
NO_CRASH_STACK + 0
crash on iOS 14.x when I useif #available(iOS 15.0, *)
with@FocusState
. I'm on Xcode 13.1