Why would it have to compile under iOS? The “import Cocoa” bit is behind an 
else clause.


Jeff Kelley

[email protected] | @SlaunchaMan <https://twitter.com/SlaunchaMan> | 
jeffkelley.org <http://jeffkelley.org/>
> On Mar 29, 2016, at 12:44 AM, Erica Sadun <[email protected]> wrote:
> 
> On Mar 28, 2016, at 10:37 PM, Jeff Kelley via swift-evolution 
> <[email protected]> wrote:
>> 
>> This might be crazy, but we could also reuse try here:
>> 
>> import Foundation
>> try import UIKit {
>>      // UIKit Code
>> }
>> else try import Cocoa
>>      // Cocoa Code
>> }
>> 
>> This would attempt to import UIKit and if it succeeded, run the code in the 
>> closure.
>> 
> 
> The problem with your approach is that the Cocoa code would have to compile 
> under iOS and 
> I'm afraid that's a no-go. Build-configuration tests enable entire blocks of 
> code to be removed
> from compilation.
> 
> -- E
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to