Changes with swift 3

Interested in seeing some of the recent changes in the swift 3 update from Apple.inc?

For starters Apple changed a lot in the transition from Swift 1 to Swift 2, and they have done it once again. There are some pretty small changes but they have a big effect in migration from one version of the language to the other.

In swift 3 unless otherwise stated labels are now required, method names lose their detail but get shorter, and the detail is often moved inside the parenthesis and becomes the first parameters name.

For all examples below the top line of code is swift 2.2 and the bottom line of code is the update swift 3.

_config.yml

^This details how the details of what is being done is sort of shifted around, this change tightens up the code and makes it more concise

_config.yml

^Another good example of a similar situation, ‘scheduledTimerWithTimeInterval’ becomes ‘scheduledTimer’ and timeInterval moves in to be the first parameters name.

_config.yml

^In this example we see that in swift 3 we must add an underscore before the first parameter to tell the compiler that the calling object will not be using a label for the parameter.

As you can see a big focus for Apple.inc in doing this update was to try to make the code make more sense, clean it up a bit, as well as make it fit in more with the famous languages of days past. They took it a step further in the sense that they started to see what types of things they could remove without jeopardizing the languages flexability.

_config.yml

^This is a simple on but as you can see the word ‘color’ after yellow on the top line is just unnecessary and so it was removed. It also changed from a function to an atribute.

_config.yml

^This time they removed the index part of ‘atIndex’ because its implied where you’re inserting the name.

!UNDER CONSTRUCTION!

!RETURN LATER FOR MORE INFO ABOUT SWIFT 3 CHANGES!

Written on December 6, 2016