Hi,
I am struggling to add new views only available on iOS 14 while maintaining compatibility with iOS 13.
What I'd like is using a LazyVStack on iOS 14 and a List on iOS 13.
The following code compiles correctly but I am getting a ETCBADACCESS error on runtime on iOS 13.
If I switch to VStack instead of LazyVStack (so a view available in iOS 13), the crash disappears.
So it looks like SwiftUI tries to run the code in the #available block even though it's running iOS 13.
Do you have any suggestions ?
Thanks
I am struggling to add new views only available on iOS 14 while maintaining compatibility with iOS 13.
What I'd like is using a LazyVStack on iOS 14 and a List on iOS 13.
The following code compiles correctly but I am getting a ETCBADACCESS error on runtime on iOS 13.
If I switch to VStack instead of LazyVStack (so a view available in iOS 13), the crash disappears.
So it looks like SwiftUI tries to run the code in the #available block even though it's running iOS 13.
Do you have any suggestions ?
Thanks
Code Block swift var body: some View { Group { if #available(iOS 14.0, *) { ScrollView { LazyVStack { content .padding(.horizontal, 15) } } } else { List { content } } } }