how to make a conditional view in SwiftUI with a targetEnvironment which checks for macCatalyst?
Something like:
#if targetEnvironment(macCatalyst)
print("macOS")
#else
print("Your regular code")
#endif
But directly in SwiftUI
struct ContentView: View {
var body: some View {
VStack {
#if targetEnvironment(macCatalyst)
Button("Catalyst Demo") { }
#endif
Text("Hello, World!")
}.frame(width: 300, height: 200)
}
}