2016
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

 Year Of Swift

 January 14, 2016

 Happy New Year!


Before the Meeting

This is the place to start your Year Of Swift!

First things first, you'll need to get Xcode on your Mac. It's a free download on the Mac App Store!

Then, download the Happy New Year Playground. Open this .zip file to get the .playground file, and double-click that file to open Xcode. Take a read thru the playground and follow along with the examples to learn some of the basics of the playground and a bit about Swift as your first lesson.


Meeting Notes (January 14, 2016)

We had a good first meeting. Here's what we discussed:

Some of the specific things that were asked this time:


Within the Happy New Year playgrond, there is a line of code:

for item in items

Why is this named item and the other one is named items?
item is a new variable that is created and holds the value of each thing in the items array. There is no reason why item couldn't be named anything else, even an Ice Cream Cone emoji works in Swift! John chose item here as a convention. John tends to name variables that are arrays with a plural name (like items) and then use the singular form when looping thru the array, so you are looking at one particular item in the array of items each time thru the array.


In the February Coupling playground, ther is a function that is defined as:

func total2(priceOne: Double, priceTwo: Double) -> Double

But the code that calls that function looks like this:

total2(2, priceTwo: 4.95)

Why wouldn't te call look like total2(priceOne:2, priceTwo: 4.95) ?

Swift's default convention for functions is to not require the name for the first parameter, but require the name for each additional parameter, so you don't normally put the priceOne name when calling this function. Now, since you made the function, you can decide how it has to be called if you want to. So you can make it so that people have to give the names like this:

func total2(priceOne priceOne: Double, priceTwo: Double) -> Double

...or, you can even make it so that none of the names have to be given at all, like this:

func total2(priceOne: Double, _ priceTwo: Double) -> Double

The underscore _ is used in a few different places in Swift as a way of saying there should normally be something there, but we kinda don't care what that is and don't feel like even putting a name to that thing.