[swift-evolution] [Draft] Adding a Build Configuration Import Test

Erica Sadun erica at ericasadun.com
Tue Mar 22 23:28:18 CDT 2016


I'm preparing a separate platform proposal. I want to make clear that the intent is to use the 
framework being tested. However, the test that does the import may be separated from the code
that uses the framework, which is why the call does not import.

-- E


> On Mar 22, 2016, at 10:24 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> #if canImport(UIKit)
>>   // UIKit-based code
>>   #elseif canImport(Cocoa)
>>   // OSX code
>>   #elseif
>>   // Workaround/text, whatever
>> #endif
> 
> My question is simple: Are there cases where you want to test if you can import something, but you don't want to *actually* import it? If not, should we perhaps just do this?
> 
> 	#if import UIKit
> 		// UIKit-based code, has UIKit available
> 	#elseif import Cocoa
> 		// OS X code, has Cocoa available
> 	#else
> 		// Fallback
> 	#endif
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 



More information about the swift-evolution mailing list