With some inspiration from Swift Fundamentals The Language of iOS Development by Mark Lassoff (ISBN 9780990402053), today, we touch on some of the following elements of the Xcode (IDE) use of the Swift language … you guessed it … The Language of iOS Development …
- variable data types String and Int and Bool
- array
- dictionary
- if statements
- for loops
- string concatenation (in println statements)
… in Xcode you can test such Swift functionality in the “Playground” (functionality) section.
You see the results of your coding as they build up over to the right of the Xcode window, pretty much instantaneously. To “drill” down to results of a loop click the “Value History” round buttons, where this takes you to graphical representations of the data … quite cute really.
So these are some of the bits and pieces of knowledge you can develop further to build up ideas for the creation of iOS mobile applications, which you may eventually want to sell on the Apple App Store (eg. for Australia).
You may wonder with the arrays (in section-1.swift) why there is a separate “tophomeawaypoints:[String: Int]” dictionary and “bothomeawaypoints:[String: Int]” one as well (also for “top8:[String]” array and a “bot10:[String]” by association). Well, this was done, really, following the advice of the Swift interpreter, saying that the structure was “too complex” to have the one dictionary and one array here.
So take a look at today’s Swift programming source code you could call section-1.swift where we analyze the AFL 2014 Home and Away Ladder hoping that Collingwood has a better 2015!
If this was interesting you may be interested in this too.
15 Responses to Swift Dictionaries and Arrays Primer Tutorial