[swift-evolution] Idea: Support #if os(Darwin) as shorthand for os(iOS) || os(OSX) || os(watchOS) || os(tvOS)
Brent Royal-Gordon
brent at architechies.com
Fri Feb 19 22:01:03 CST 2016
> • Is the target an Apple platform (iOS, OS X, tvOS, watchOS) or not? (Answers the question "can I import Foundation"?)
Well, Corelibs Foundation will muddy those waters.
> • Is the target a "common UIKit platform" (compiles on both iOS and tvOS) or not? (Answers the question "can I import UIKit"?)
Maybe test for the presence of a particular module?
#if supports(Foundation)
#if supports(UIKit)
Or allow conditional importing of a module?
#if import UIKit
// Only compiled if UIKit imported; all UIKit APIs usable here
#elseif import AppKit
// Only compiled if AppKit imported; all AppKit APIs usable here
#endif
// No AppKit or UIKit APIs usable here
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list