Swift setup for different versions


(alex) #1

Hi,

I’m a Swift newbie, going through the Swift books (2.1 and 2.2). I’m a bit
confused and I’d appreciate your help with setting up a good environment.

1. I have Xcode 7.2.1 installed. This seems to correspond to Swift 2.1.1
which I assume is the stable version.

2. There are release snapshots for 2.2 available on swift.org.

Q2.1: can one run in parallel Swift 2.1.1 and 2.2 snapshots? If yes, what
setup do I need?

Q2.2: I read that 2.2 snapshots do not include the Package manager. Can it
be installed separately?

3. I’ve heard about the upcoming big 3.0 Swift version.

Q3.1: are there development snapshots available?

Q3.2: as above, can one run 2.1, 2.2, and 3.0 snapshots in parallel on the
same system? (if yes, please do include any links on how the setup looks
like)

thanks a lot for your help,

:- a


(Jens Alfke) #2

Then that’s all you need. If you’re learning the language, you definitely don’t want to be on the bleeding edge; it’ll get in the way.

I’m sure the vast majority of developers using Swift are working with the released version in Xcode. And it’s not stopping them from getting things done.

(BTW, the latest Xcode 7.3 beta apparently has Swift 2.2, or so I’ve heard. I haven’t checked.)

—Jens

···

On Feb 13, 2016, at 2:05 PM, alex via swift-users <swift-users@swift.org> wrote:

I’m a Swift newbie, going through the Swift books (2.1 and 2.2). I’m a bit confused and I’d appreciate your help with setting up a good environment.
1. I have Xcode 7.2.1 installed. This seems to correspond to Swift 2.1.1 which I assume is the stable version.


(Seán Labastille) #3

Hi Alex,

Since you mentioned you have Xcode 7.2.1 installed I presume you’ll want to have this setup on OS X.

Up until Xcode 7.3 Swift has always been bundled with Xcode (as it was not open sourced yet).

https://swift.org/download/#apple-platforms is the place to look for snapshots from 2.2 onwards.
Here you will find snapshots both for the release branch of 2.2 and development which will contain features intended for 3.0, but not included in 2.2.

You can install multiple of these, and in Xcode 7.3 you get an overview of the versions installed (you can also find them in /Library/Developer/Toolchains) and switch between these easily.

On the command line you can use xcrun to choose which toolchain you want to use:

16-02-15 6:48:03 ➜ ~ xcrun --toolchain org.swift.2220160208a swift build
error: unable to invoke subcommand: /Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swift-build (No such file or directory)
16-02-15 6:48:26 ➜0 ~ xcrun --toolchain org.swift.3020160208a swift build
error: no Package.swift file found

Notice that you need to use the toolchain’s bundle identifier (check the Info.plist) to identify the toolchain precisely.

For Swift 2.1 you’ll need to use Xcode 7.2 and use xcode-select if you want to use that on the command line, as well as for switching back to 7.3.

I hope this helps,

Seán

···

On 13 Feb 2016, at 23:05, alex via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Hi,

I’m a Swift newbie, going through the Swift books (2.1 and 2.2). I’m a bit confused and I’d appreciate your help with setting up a good environment.

1. I have Xcode 7.2.1 installed. This seems to correspond to Swift 2.1.1 which I assume is the stable version.

2. There are release snapshots for 2.2 available on swift.org <http://swift.org/>.

Q2.1: can one run in parallel Swift 2.1.1 and 2.2 snapshots? If yes, what setup do I need?

Q2.2: I read that 2.2 snapshots do not include the Package manager. Can it be installed separately?

3. I’ve heard about the upcoming big 3.0 Swift version.

Q3.1: are there development snapshots available?

Q3.2: as above, can one run 2.1, 2.2, and 3.0 snapshots in parallel on the same system? (if yes, please do include any links on how the setup looks like)

thanks a lot for your help,

:- a
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(Seán Labastille) #4

Hi Alex,

Since you mentioned you have Xcode 7.2.1 installed I presume you’ll want to have this setup on OS X.

Up until Xcode 7.3 Swift has always been bundled with Xcode (as it was not open sourced yet).

https://swift.org/download/#apple-platforms is the place to look for snapshots from 2.2 onwards.
Here you will find snapshots both for the release branch of 2.2 and development which will contain features intended for 3.0, but not included in 2.2.

You can install multiple of these, and in Xcode 7.3 you get an overview of the versions installed (you can also find them in /Library/Developer/Toolchains) and switch between these easily.

On the command line you can use xcrun to choose which toolchain you want to use:

16-02-15 6:48:03 ➜ ~ xcrun --toolchain org.swift.2220160208a swift build
error: unable to invoke subcommand: /Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swift-build (No such file or directory)
16-02-15 6:48:26 ➜0 ~ xcrun --toolchain org.swift.3020160208a swift build
error: no Package.swift file found

Notice that you need to use the toolchain’s bundle identifier (check the Info.plist) to identify the toolchain precisely.

For Swift 2.1 you’ll need to use Xcode 7.2 and use xcode-select if you want to use that on the command line, as well as for switching back to 7.3.

I hope this helps,

Seán

···

On 13 Feb 2016, at 23:05, alex via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Hi,

I’m a Swift newbie, going through the Swift books (2.1 and 2.2). I’m a bit confused and I’d appreciate your help with setting up a good environment.

1. I have Xcode 7.2.1 installed. This seems to correspond to Swift 2.1.1 which I assume is the stable version.

2. There are release snapshots for 2.2 available on swift.org <http://swift.org/>.

Q2.1: can one run in parallel Swift 2.1.1 and 2.2 snapshots? If yes, what setup do I need?

Q2.2: I read that 2.2 snapshots do not include the Package manager. Can it be installed separately?

3. I’ve heard about the upcoming big 3.0 Swift version.

Q3.1: are there development snapshots available?

Q3.2: as above, can one run 2.1, 2.2, and 3.0 snapshots in parallel on the same system? (if yes, please do include any links on how the setup looks like)

thanks a lot for your help,

:- a
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(Max Howell) #5

Q2.2: I read that 2.2 snapshots do not include the Package manager. Can it be installed separately?

The 3.0 development snapshots come with SwiftPM.

However if you want to use a 2.2 snapshot, you can install SwiftPM separately. There are instructions at its github page.


(alex) #6

I’m a Swift newbie, going through the Swift books (2.1 and 2.2). I’m a bit
confused and I’d appreciate your help with setting up a good environment.
1. I have Xcode 7.2.1 installed. This seems to correspond to Swift 2.1.1
which I assume is the stable version.

Then that’s all you need. If you’re learning the language, you definitely
don’t want to be on the bleeding edge; it’ll get in the way.

I'm still hoping for some answers to my questions. I'm mostly interested in
the language and its evolution. I'm also sure that most of the core
developers and those in the community have already figured these details
out.

Thanks

:- a

···

On Saturday, February 13, 2016, Jens Alfke <jens@mooseyard.com> wrote:

On Feb 13, 2016, at 2:05 PM, alex via swift-users <swift-users@swift.org > <javascript:_e(%7B%7D,'cvml','swift-users@swift.org');>> wrote:

—Jens