This worked for me:
var body: some View {
someView()
}
func someView() -> AnyView {
if #available(iOS 14.0, *) {
return AnyView(Text("iOS 14"))
} else {
return AnyView(Text("iOS 13"))
}
}
}