{"id":10998,"date":"2014-12-10T05:03:55","date_gmt":"2014-12-09T18:03:55","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=10998"},"modified":"2014-12-10T05:03:55","modified_gmt":"2014-12-09T18:03:55","slug":"swift-hello-world-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/swift-hello-world-primer-tutorial\/","title":{"rendered":"Swift Hello World 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\/HelloWorld\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Swift Hello World Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/HelloWorld\/Swift_HelloWorld-95of.jpg\" title=\"Swift Hello World Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Swift Hello World Primer Tutorial<\/p><\/div>\n<p>The last (and only) time we talked about Apple&#8217;s new programming language for iOS development, <a target=_blank title='Swift' href='https:\/\/developer.apple.com\/swift\/'>Swift<\/a>, was in terms of learning a bit about the similar Rust language when we presented <a target=_blank href='#rpt' title='Rust Primer Tutorial'>Rust Primer Tutorial<\/a> as shown below, mainly because it was hard, then, at least for us, to track down much about the Swift language.<\/p>\n<p>Things have moved on since, and with iOS 8.1 you can develop Swift based mobile applications totally with Swift, instead of Objective-C, and as with recent times of Objective-C iOS work the Storyboard has taken over as the default GUI arrangement in preference to the use of XIB files.<\/p>\n<p>Today&#8217;s project is a Hello World project, so it is very simple, and, perhaps, unless you are well into Swift already, it is best to start simple and build up.  With this in mind we model the Hello World project on the advice from <a target=_blank href='http:\/\/www.makemegeek.com\/hello-world-example-swift\/' title='Hello World Example in Swift'>Hello World Example in Swift<\/a> (thanks) but please bear in mind that it ended up to be simpler in iOS 8.1 because we can pick a &#8220;Single View iOS Application&#8221; and use Storyboards, and lots of the AppDelegate.swift advice is no longer required to achieve, now, in iOS 8.1, with regard to what that tutorial sets out to achieve &#8230; and all that we aim to achieve today with the application Run today on an iPhone simulator and a real iPad device.<\/p>\n<p>Don&#8217;t like to give up on Objective-C, but have to say, that by the end of a day of struggle, I can see and feel that there could be some good streamlinings lately in the organization of these Xcode iOS mobile projects in Swift &#8230; maybe Swift by name, and &#8220;pretty fast&#8221; by nature &#8230; chortle, chortle.<\/p>\n<p>If you think &#8220;control drag&#8221; is no longer needed, though, think again &#8230; Mac laptop keyboard &#8220;control drag&#8221; was used to create the blue line links on <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/HelloWorld\/Swift_HelloWorld-87of.jpg\">this tutorial slide<\/a> &#8230; &#8220;practice makes perfect&#8221;.<\/p>\n<p>Here are two parts of the Swift code for our Hello World application you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/HelloWorld\/AppDelegate.swift_GETME\" title=\"AppDelegate.swift\">AppDelegate.swift<\/a> and <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/iOS8\/Swift\/HelloWorld\/ViewController.swift_GETME\" title=\"ViewController.swift\">ViewController.swift<\/a><\/p>\n<p>Hope you enjoy using Swift.<\/p>\n<hr \/>\n<p id='rpt'>Previous relevant <a target=_blank href='http:\/\/www.rjmprogramming.com.au.wordpress\/?p=7932' title='Rust Primer Tutorial'>Rust Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Rust\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Rust Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Rust\/Rust_Primer-39of.jpg\" title=\"Rust Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Rust Primer Tutorial<\/p><\/div>\n<p>The <a target=_blank href='http:\/\/taocurrents.files.wordpress.com\/2011\/12\/mp13a.jpg?w=529&#038;h=576' title='Thanks for this.'>wind<\/a> is still blowing.  And they (that being a really tiny proportion of the populace, at large) are still calling the wind <a target=_blank href='http:\/\/www.youtube.com\/watch?v=3DrOqRQQ9mg' title='They call the wind Mariah'>Mariah<\/a>.  Do you see those exhausted butterflies in Brazil flapping (a bit less than) faster?<\/p>\n<p>Today we try out the programming language Rust, mainly because it has a lot in common with the upcoming iOS language Swift, and because Rust looks very powerful.   Rust is an open source language that relies on a few prerequisites for installation.   As we had these pre-requisites here, luckily, on this Mac laptop we did not have to wrestle with these issues (personally, I like the <strike>abominable stretch<\/strike> abdominal stretch (by <a target=_blank title='Mario Milano' href='https:\/\/www.google.com.au\/search?q=%22mario+milano%22+%22abdominal+stretch%22&#038;tbm=isch&#038;source=lnms&#038;sa=X&#038;ei=oumPU5GIIY26lQX88ICYDQ&#038;ved=0CAYQ_AUoAQ&#038;biw=1061&#038;bih=553#facrc=_&#038;imgdii=_&#038;imgrc=FFuILecN5eGfmM%253A%3B63-Knp066fwUJM%3Bhttp%253A%252F%252Fwww.onlineworldofwrestling.com%252Fpictures%252F11%252Farionlewin.jpg%3Bhttp%253A%252F%252Fforums.leagueunlimited.com%252Fshowthread.php%253Fp%253D6295319%3B602%3B494'>Mario Milano<\/a>) regarding &#8220;best techniques&#8221; here).  Below are what this hugely useful <a target=_blank title='Rust prerequisites' href='http:\/\/doc.rust-lang.org\/tutorial.html#getting-started'>link<\/a> explains are the prerequisites for Rust usage:<\/p>\n<ul>\n<li>g++ 4.7 or clang++ 3.x<\/li>\n<li>python 2.6 or later (but not 3.x)<\/li>\n<li>perl 5.0 or later<\/li>\n<li>gnu make 3.81 or later<\/li>\n<li>curl<\/li>\n<\/ul>\n<p>So, today, we try a Hello World scenario in Rust.  The motivation here is learning and preparation for future use of Swift for Xcode iOS 8 programming, perhaps.  As they say in the boy scouts &#8220;be prepared&#8221;.<\/p>\n<p>Here is the Rust programming source code used here, which you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Rust\/hellofromrjm.rs_GETME\" title='hellofromrjm.rs'>hellofromrjm.rs<\/a><\/p>\n<p>Here is a link to a <a target=_blank title='Rust home page' href='http:\/\/www.rust-lang.org\/'>Rust<\/a> home page.<\/p>\n<p>Hope you get something out of today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Rust\/\" title='Click picture.'>tutorial<\/a>.   We give thanks to the information of some of the links on this <a target=_blank href='https:\/\/www.google.com.au\/?gfe_rd=ctrl&#038;ei=3s4rU6TsBsHC8gfOtYHAAw&#038;gws_rd=cr#q=%22Swift%22+%22iOS%22' title='Thanks'>Google search<\/a> for the leads here.<\/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='#7932' onclick='var dv=document.getElementById(\"d7932\"); 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='d7932' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\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='#10998' onclick='var dv=document.getElementById(\"d10998\"); 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='d10998' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The last (and only) time we talked about Apple&#8217;s new programming language for iOS development, Swift, was in terms of learning a bit about the similar Rust language when we presented Rust Primer Tutorial as shown below, mainly because it &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/swift-hello-world-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,558,626,628,630,631,723,795,852,997,1144,1204,1227,1319,1473],"class_list":["post-10998","post","type-post","status-publish","format-standard","hentry","category-elearning","category-ios","category-tutorials","category-xcode","tag-apple","tag-hello-world","tag-ios","tag-ios8","tag-ipad","tag-iphone","tag-mac","tag-mobile","tag-objective-c","tag-programming","tag-simulator","tag-storyboard","tag-swift","tag-tutorial","tag-xcode"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10998"}],"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=10998"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10998\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=10998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=10998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=10998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}