Re: Can Xcode 8 not use the new ObjC-Swift bridging?
Re: Can Xcode 8 not use the new ObjC-Swift bridging?
- Subject: Re: Can Xcode 8 not use the new ObjC-Swift bridging?
- From: Kyle Sluder <email@hidden>
- Date: Fri, 17 Jun 2016 15:25:59 -0500
On Thu, Jun 16, 2016, at 10:49 AM, David Catmull wrote:
> Even though I declined to update my project to the new Swift, Xcode is
> still using the new rules for Objective-C/Swift bridging, like
> stuffForThing: now becomes stuff(forThing:) instead of stuffForThing().
> Is
> there a way around this? I want to be able to try out the Xcode 8 beta
> without making extensive, breaking changes to my source code.
>
> I tried setting "Use legacy Swift language version" to Yes, but it didn't
> help. It's not really clear what that setting does, and I didn't see any
> other likely candidates.
>
> (I have filed this as bug 26838626)
Xcode 8 ships with two Swift toolchains:
• Swift 2.3, which has minimal changes from Swift 2.2 necessary to build
against the new SDKs
• Swift 3.0, which includes many syntax and importer changes
Notice that Xcode 8 does not ship with Swift 2.2. To build with Xcode 8,
you will need to migrate your code to either Swift 2.3 (which, again,
should be minimal if any changes) or Swift 3.0 [*].
Xcode 8 knows which toolchain you want to use by the presence of the
“Use legacy Swift language version” build setting. If that setting not
not set, you get Xcode 8’s default toolchain, which is *Swift 3.0*.
Canceling the migrator instructs Xcode not to make any changes to your
project, which means your unchanged code will try and fail to build
against Swift 3. If you want to use Swift 2.3, you will need to turn on
this setting for every target in every xcodeproj that is built as part
of your current scheme.
[*] One caveat is that the SDK sometimes uses the NS_SWIFT_NAME macro to
affect how certain symbols import into Swift. It’s not quite clear to me
whether these are toolchain-dependent. You may need to update your code
to use the new names exported by the iOS 10/macOS 12/tvOS 10/watchOS 3
SDKs, even if you build against Swift 2.3. Luckily there are relatively
few of these manually-annotated changes, and you can use Swift’s
conditional compilation syntax to keep your codebase compatible with
both Swift 2.2 on Xcode 7 and Swift 2.3 on Xcode 8.
--Kyle Sluder
_______________________________________________
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