{"id":234,"date":"2014-09-20T19:37:58","date_gmt":"2014-09-21T03:37:58","guid":{"rendered":"http:\/\/www.communistech.com\/blog\/?p=234"},"modified":"2014-09-20T19:40:21","modified_gmt":"2014-09-21T03:40:21","slug":"apples-new-swift-programming-language","status":"publish","type":"post","link":"https:\/\/www.communistech.com\/blog\/apples-new-swift-programming-language\/","title":{"rendered":"Apple&#8217;s new Swift Programming Language"},"content":{"rendered":"<p><a href=\"https:\/\/www.communistech.com\/blog\/wp-content\/uploads\/2014\/09\/SwiftLogo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-235\" alt=\"SwiftLogo\" src=\"https:\/\/www.communistech.com\/blog\/wp-content\/uploads\/2014\/09\/SwiftLogo-300x104.png\" width=\"300\" height=\"104\" srcset=\"https:\/\/www.communistech.com\/blog\/wp-content\/uploads\/2014\/09\/SwiftLogo-300x104.png 300w, https:\/\/www.communistech.com\/blog\/wp-content\/uploads\/2014\/09\/SwiftLogo.png 331w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Apple has released a new language to program iOS and OSX Apps called <a title=\"About Swift\" href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/Swift\/Conceptual\/Swift_Programming_Language\/\" target=\"_blank\">Swift<\/a>. Over the last weekend I took sometime to go through <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/Swift\/Conceptual\/Swift_Programming_Language\/GuidedTour.html\" target=\"_blank\">A Swift Tour<\/a>\u00a0section is Apple&#8217;s free <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/Swift\/Conceptual\/Swift_Programming_Language\/\" target=\"_blank\">iBook<\/a> on the subject. It&#8217;s roots are definitely in the semantics of Objective-C, but you get the full modern day benefits of languages like python and javascript. You can do more with typing less. It&#8217;s more like a scripting language.<\/p>\n<p>The real progressive part though is that it achieves less typing, by using implicit types. For example<\/p>\n<pre>var myDoublePrecisionNumber = 0.007 # This will be implicitly define the type as double\r\nvar myExplicitPrecisionNumber : Double = 0.007 # This will explicitly define the type as double<\/pre>\n<p>The first and obvious advantage is that it requires less typing, but the secondary and really neat advantage is that once implied, if a calculation assigns the value that would convert the value to a type that would be detrimental to the program, the compiler will warn or error appropriately. Catching errors, like in javascript and python, at runtime is much more &#8216;expensive&#8217; in time than at compile time.<\/p>\n<p>If you would like to see my solutions to the &#8216;Experiments&#8217; in a\u00a0<a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/Swift\/Conceptual\/Swift_Programming_Language\/GuidedTour.html\" target=\"_blank\">A Swift Tour<\/a>\u00a0you can find all the code in that section is the <a href=\"https:\/\/gist.github.com\/billbonney\/0968920dc29b7d0a677f\" target=\"_blank\">playground<\/a> file stored in a <a title=\"A Swift Tour - Solutions\" href=\"https:\/\/gist.github.com\/billbonney\/0968920dc29b7d0a677f\" target=\"_blank\">gist<\/a> on\u00a0<a href=\"http:\/\/github.com\" target=\"_blank\">github<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apple has released a new language to program iOS and OSX Apps called Swift. Over the last weekend I took sometime to go through A Swift Tour\u00a0section is Apple&#8217;s free iBook on the subject. It&#8217;s roots are definitely in the &hellip; <a href=\"https:\/\/www.communistech.com\/blog\/apples-new-swift-programming-language\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[30],"tags":[33,31,32,59,29],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-programming","tag-apps","tag-ios","tag-osx","tag-programming","tag-swift"],"_links":{"self":[{"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":5,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.communistech.com\/blog\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}