How to check platform versions in Swift
Issue #477
Mark APIs availability
1 | 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) (iOS |
Check platform
1 | #if canImport(UIKit) |
In watchOS app, it still can import UIKit
, so for only iOS usage, we need to use os
check
1 | #if canImport(UIKit) && os(iOS) |
Check environment
1 | #if targetEnvironment(macCatalyst) |
1 | #if targetEnvironment(simulator) |