So I'm trying to make it so that my app can deploy on iOS 13 (technically I'm wanting iOS 13.5) as well as iOS 14 so I've written these lines of code to test it:
struct ContentView: View {
var body: some View {
if #available(iOS 14.0, *) {
List {
Text("Cool!")
Text("Cool!")
Text("Cool!")
Text("Cool!")
}
.listStyle(InsetGroupedListStyle())
} else {
List {
Text("Cool!")
Text("Cool!")
Text("Cool!")
Text("Cool!")
}
.listStyle(GroupedListStyle())
.environment(\.horizontalSizeClass, .regular)
}
}
}
Building to iOS 14 works great, however, whenever I build to iOS 13.5 on a physical phone and the simulator, I get this error in the AppDelegate:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
I've made sure to set my iOS Deployment Target to iOS 13.5 and I'm using Xcode 12 beta 2. I have tried using beta 1 with the same result (though I used the same file, so potentially that's why?). I'm not sure if I'm doing anything wrong or if this is a bug. When using the code for iOS 13.5 alone (without the if #available) it works as expected, but only when I add that checker is when my problems arise. Any help would be appreciated!