• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I set build configurations in Swift code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I set build configurations in Swift code?


  • Subject: Re: Can I set build configurations in Swift code?
  • From: Britt Durbrow <email@hidden>
  • Date: Mon, 07 Jul 2014 23:04:00 -0700

Also - how would code that isn’t always valid be handled? In other words:

#if SOMECONFIGA
	doSomethingValidInConfigAButNotValidWhenNotInConfigA();
#else
	doSomethingValidInConfigBButNotValidWhenNotInConfigB();
#endif

If the compiler is evaluating everything inside the #if #else #endif sections, regardless of the value of SOMECONFIGA, won’t that lead to syntax errors, unresolved symbol issues, etc no matter the value of SOMECONFIGA?

The use case that comes to mind off of the top of my head (but, I’m sure that there are others) is code that can use multiple libraries to accomplish a task, depending on what platform or app it’s being compiled for.

On Jul 7, 2014, at 9:20 PM, Chris Lattner <email@hidden> wrote:

> On Jul 7, 2014, at 8:50 PM, Gerriet M. Denkmann <email@hidden> wrote:
>> But: I get lots of warnings "Will never be executed" for all OTHER_FLAGs.
>> I do NOT want to switch off this warning, as it probably is rather useful.
>> But I do much prefer to have code which compiles without warnings.
>>
>> So: is there a way to define build configurations in code (other than in the Build Settings of Xcode) ?
>>
>> Or: how else to handle conditionally compiled code in Swift?
>
> Interesting: we don't have a good solution for this at the moment, please file a radar.
>
> -Chris
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Can I set build configurations in Swift code? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Can I set build configurations in Swift code? (From: Chris Lattner <email@hidden>)

  • Prev by Date: Re: Swift crash in dispatch_apply
  • Next by Date: Re: Can I set build configurations in Swift code?
  • Previous by thread: Re: Can I set build configurations in Swift code?
  • Next by thread: Re: Can I set build configurations in Swift code?
  • Index(es):
    • Date
    • Thread