{"id":13789,"date":"2015-04-18T05:07:37","date_gmt":"2015-04-17T19:07:37","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=13789"},"modified":"2020-01-15T20:39:34","modified_gmt":"2020-01-15T10:39:34","slug":"swift-dictionaries-and-arrays-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/swift-dictionaries-and-arrays-primer-tutorial\/","title":{"rendered":"Swift Dictionaries and Arrays Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/Dictionary\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Swift Dictionaries and Arrays Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/Dictionary\/Swift_Dictionary.jpg\" title=\"Swift Dictionaries and Arrays Primer Tutorial\" id='isdaapt' onmouseover=\"  this.src=this.src.replace('-73','-x74').replace('-74','-x75').replace('-75','-x76').replace('-76','-x77').replace('-77','-x78').replace('-78','-x73').replace('-x','-');     \" \/><\/a><p class=\"wp-caption-text\">Swift Dictionaries and Arrays Primer Tutorial<\/p><\/div>\n<p>With some inspiration from <i>Swift Fundamentals<\/i> <i><font size=2>The Language of iOS Development<\/font><\/i> by Mark Lassoff (ISBN 9780990402053), today, we touch on some of the following elements of the Xcode (IDE) use of the Swift language &#8230; you guessed it &#8230; The Language of iOS Development &#8230;<\/p>\n<ul>\n<li>var<font size=1>iable<\/font> data types String and Int and Bool<\/li>\n<li>array<\/li>\n<li>dictionary<\/li>\n<li>if statements<\/li>\n<li>for loops<\/li>\n<li>string concatenation (in println statements)<\/li>\n<\/ul>\n<p> &#8230; in Xcode you can test such Swift functionality in the <a target=_blank title='Swift playground information from Apple' href='https:\/\/developer.apple.com\/swift\/'>&#8220;Playground&#8221;<\/a> (functionality) section.<\/p>\n<p>You see the results of your coding as they build up over to the right of the Xcode window, pretty much instantaneously.  To &#8220;drill&#8221; down to results of a loop click the &#8220;Value History&#8221; round buttons, where this takes you to graphical representations of the data &#8230; quite cute really.<\/p>\n<p>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 <a target=_blank href='http:\/\/www.apple.com\/au\/' title='Apple App Store for Australia'>Australia<\/a>).<\/p>\n<p>You may wonder with the arrays (in <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/Dictionary\/section-1.swift_GETME' title='section-1.swift'>section-1.swift<\/a>) why there is a separate &#8220;tophomeawaypoints:[String: Int]&#8221; dictionary and &#8220;bothomeawaypoints:[String: Int]&#8221; one as well (also for &#8220;top8:[String]&#8221; array and a &#8220;bot10:[String]&#8221; by association).   Well, this was done, really, following the advice of the Swift interpreter, saying that the structure was &#8220;too complex&#8221; to have the one dictionary and one array here.<\/p>\n<p>So take a look at today&#8217;s Swift programming source code you could call <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/Dictionary\/section-1.swift_GETME' title='section-1.swift'>section-1.swift<\/a> where we analyze the AFL <a target=_blank title='AFL 2014 Home and Away Ladder' href='http:\/\/www.bigfooty.com\/forum\/threads\/afl-2014-ladder-predictions.1038901\/page-99'>2014<\/a> Home and Away Ladder hoping that Collingwood has a better 2015!<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d13789' onclick='var dv=document.getElementById(\"d13789\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=iOS\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d13789' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8230; you guessed it &#8230; The &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/swift-dictionaries-and-arrays-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,20,37,40],"tags":[91,103,326,585,626,723,997,1227,1319,1473],"class_list":["post-13789","post","type-post","status-publish","format-standard","hentry","category-elearning","category-ios","category-tutorials","category-xcode","tag-apple","tag-array","tag-dictionary","tag-ide","tag-ios","tag-mac","tag-programming","tag-swift","tag-tutorial","tag-xcode"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13789"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=13789"}],"version-history":[{"count":1,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13789\/revisions"}],"predecessor-version":[{"id":47694,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13789\/revisions\/47694"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=13789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=13789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=13789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}