|
|
|
@ -13,7 +13,16 @@ struct ContentView: View { |
|
|
|
|
Image(systemName: "globe") |
|
|
|
|
.imageScale(.large) |
|
|
|
|
.foregroundColor(.accentColor) |
|
|
|
|
Text("Hello, world!") |
|
|
|
|
|
|
|
|
|
#if os(iOS) |
|
|
|
|
Text("Hello \(UIDevice.isIPad ? "iPadOS" : "iOS")") |
|
|
|
|
#elseif os(macOS) |
|
|
|
|
Text("Hello macOS") |
|
|
|
|
#elseif os(tvOS) |
|
|
|
|
Text("Hello tvOS") |
|
|
|
|
#elseif os(watchOS) |
|
|
|
|
Text("Hello watchOS") |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
.padding() |
|
|
|
|
} |
|
|
|
@ -24,3 +33,15 @@ struct ContentView_Previews: PreviewProvider { |
|
|
|
|
ContentView() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if os(iOS) |
|
|
|
|
extension UIDevice { |
|
|
|
|
static var isIPad: Bool { |
|
|
|
|
UIDevice.current.userInterfaceIdiom == .pad |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static var isIPhone: Bool { |
|
|
|
|
UIDevice.current.userInterfaceIdiom == .phone |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|