So, I just started on "Swift Tutorial 1: Welcome to Programming” by Brian Moakley a couple of weeks ago, I am busy for a few days, come back to it and Brian’s tutorials have been replaced by ones written by Matt Galloway. Nothing against Matt , but this is not good for continuity of learning. How often are newbies/continuing students expected to start from scratch again?
Not very often… but you chose to read that tutorial in a bad time. Swift 3 has been out for few days… and many basic tutorials are being/been updated. I’ve given that tutorial a lecture, and if you understood it, there’s not much new and Swift 3 related (differently from Swift 2) that you can learn from it… so I think you should simply move on.
Also Apple stated in github that Swift 3 is the last breaking-changes release, so every effort from now in future Swifts (even 4+) should be source-compatible with legacy Swift 3.0 code. (Though it’s not guaranteed for every future feature, this is their goal now)
Thanks, I’ll move on, but first can you clarify the following: I used Xcode 8, Beta 5 before which contained Swift version 2.2. I have removed this from my Mac now and downloaded/installed Xcode 8.1, which according to the release notes uses Swift version 2.3. However, when I run the “swift –version” command in Terminal, it reports version 2.2.
I don’t know exactly about this… but Swift 2.3 is basically Swift 2.2 syntax along with iOS 10 APIs that wouldn’t otherwise be available.
What I was trying to say is that Xcode 8.1 is supposed to contain Swift 3 as part of the toolchain. In fact, so was version 8. Isn’t that why the tutorial was upgraded?
Okay, so whilst waiting for a response I found these lines of code on Stackoverflow to run within Xcode:
#if swift(>=3.0)
print(“Hello, Swift 3!”)
#elseif swift(>=2.2)
print(“Hello, Swift 2.2!”)
#elseif swift(>=2.1)
print(“Hello, Swift 2.1!”)
#endif
Sure enough, the results sidebar reports “Hello, Swift 3!\n”
The question is why does Terminal identify only version 2.2?