Issue #477
Mark APIs availability
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
public extension View {
}
Check platform
#if canImport(UIKit)
import UIKit
#elseif canImport(OSX)
import AppKit
#endif
In watchOS app, it still can import UIKit
, so for only iOS usage, we need to use os
check
#if canImport(UIKit) && os(iOS)
Check environment
#if targetEnvironment(macCatalyst)
print("UIKit running on macOS")
#else
print("Your regular code")
#endif
#if targetEnvironment(simulator)
// your simulator code
#else
// your real device code
#endif