How can we create a dictionary in Swift
To create an empty dictionary
var myDictionary = Dictionary<String,String>()
A typical dictionary has a key, value pair, so
myDictionary["user"] = "Sander"
This dictionary has now one entry
assert(myDictionary.description == "[user: Sander]")
Add an extra value to the dictionary
The content of the dictionary will be
assert(myDictionary.description == "[user: Renny, password: Secret!]") // (!)Watch the space behind the :
This defines an Array.
var keyWords = [ "let","println","var" ]
You can use it like this.
assert ("println" == keyWords)
To change a value.
keyWords = “case”
To define an empty array, type:
var emptyArray = 
The first program in every language is a ‘Hello, world’ example.
Let´s honor this tradition, but enhance it a little bit.
println ("Hello, Swift!")
let Sander = "Sander" // constant
var Renny = "Renny" // variable
This is everything that is needed tot create the complete program.
I think it is Groovy!
This is AppCoach, Your Coach in the land of Swift!
It is all about developing iOS / OS X Applications using the new language Swift. The language is new and we want to learn it. We also want to share our learning by writing small articles how to use swift, of course with a lot of sample code, thats the way We learn in the end Appcoach will lead you trough the land of Swift.
Who we are?
We are Sander and Renny, developers and in the process of writing applications for iOS / OS X and starting to use the new language Swift.
Please feel free to use these examples in anyway you like. Have fun!
(c) AppCoach 2014