{"id":15776,"date":"2016-09-20T23:41:14","date_gmt":"2016-09-21T03:41:14","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=15776"},"modified":"2016-09-28T15:31:58","modified_gmt":"2016-09-28T19:31:58","slug":"swift-3-notes","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/09\/20\/swift-3-notes\/","title":{"rendered":"Swift 3 Notes"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/blog\/swift-3-0-released\/\">Ted Kremenek<\/a> (<a href=\"https:\/\/news.ycombinator.com\/item?id=12493822\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/swift.org\/blog\/swift-3-0-released\/\">\n<p>Swift 3.0, the first major release of Swift since it was open-sourced, is now officially released! Swift 3 is a huge release containing major improvements and refinements to the core language and Standard Library, major additions to the Linux port of Swift, and the first official release of the Swift Package Manager.<\/p>\n<\/blockquote>\n<p>It&rsquo;s great that he links to all the enhancement proposals.<\/p>\n\n<p><a href=\"https:\/\/oleb.net\/blog\/2016\/08\/swift-3-strings\/\">Ole Begemann<\/a>:<\/p>\n<blockquote cite=\"https:\/\/oleb.net\/blog\/2016\/08\/swift-3-strings\/\">\n<p>This is an excerpt from the Strings chapter in <a href=\"https:\/\/www.objc.io\/books\/advanced-swift\/\"><em>Advanced Swift<\/em><\/a>. <a href=\"http:\/\/chris.eidhof.nl\">Chris Eidhof<\/a> and I are currently updating the book for Swift 3 (and improving it in the process). This section on strings was originally written by <a href=\"https:\/\/airspeedvelocity.net\">Airspeed Velocity<\/a> for the first edition of the book, and Chris and myself updated it for the <a href=\"https:\/\/www.objc.io\/blog\/2016\/08\/22\/announcements\/\">upcoming edition<\/a>.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/olebegemann\/status\/772853848255922177\">Ole Begemann<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/olebegemann\/status\/772853848255922177\"><p>Trick question: does a string in Swift 3 always contain its prefix?<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/oleb.net\/blog\/2016\/09\/swift-3-ranges\/\">Ole Begemann<\/a>:<\/p>\n<blockquote cite=\"https:\/\/oleb.net\/blog\/2016\/09\/swift-3-ranges\/\"><p>In Swift 2, ranges were closely connected to collections. A range&rsquo;s element type had to be an index type, and ranges themselves were also collections. This model underwent significant changes in Swift 3 as part of <a title=\"Swift Evolution Proposal SE-0065: A New Model for Collections and Indices\" href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/master\/proposals\/0065-collections-move-indices.md\">the new collection indexing model<\/a>. Because the old index protocols no longer exist, the only constraint on a range&rsquo;s element type is now <a href=\"https:\/\/developer.apple.com\/reference\/swift\/comparable\"><code>Comparable<\/code><\/a> conformance. And since the range elements now can no longer advance themselves, it follows that <code>Range<\/code> can&rsquo;t be a <a href=\"https:\/\/developer.apple.com\/reference\/swift\/collection\"><code>Collection<\/code><\/a> anymore, at least not without additional constraints. As a matter of fact, the <a href=\"https:\/\/developer.apple.com\/reference\/swift\/range\"><code>Range<\/code><\/a> type in Swift 3 is closer in concept to what used to be called intervals in Swift 2.<\/p><\/blockquote>\n\n<p><a href=\"http:\/\/ericasadun.com\/2016\/06\/08\/swift-the-joy-of-sequences\/\">Erica Sadun<\/a>:<\/p>\n<blockquote cite=\"http:\/\/ericasadun.com\/2016\/06\/08\/swift-the-joy-of-sequences\/\">\n<p>I am&nbsp;really happy with how <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/master\/proposals\/0094-sequence-function.md\">SE-0094<\/a> turned out. I helped with the paperwork but it was all <a href=\"http:\/\/www.twitter.com\/Eridius\">Kevin Ballard<\/a>&lsquo;s brain child, putting together the two new sequence functions.&nbsp;If you haven&rsquo;t been playing with these yet, they&rsquo;re available in the latest developer snapshots (both the main trunk and the public branch) and they&rsquo;re delightful.<\/p>\n<\/blockquote>\n\n<p><a href=\"http:\/\/inessential.com\/2016\/09\/08\/adding_a_notification_observer_in_swift_\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/inessential.com\/2016\/09\/08\/adding_a_notification_observer_in_swift_\">\n<p>Note that the Objective-C name <code>SomethingHappenedNotification<\/code> becomes just <code>.SomethingHappened<\/code> in Swift, and it&rsquo;s automatically a Notification.Name.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/thatthinginswift.com\/automatic-migration-to-swift-3-with-xcode\/\">Nick O&rsquo;Neill<\/a>:<\/p>\n<blockquote cite=\"https:\/\/thatthinginswift.com\/automatic-migration-to-swift-3-with-xcode\/\"><p>These are just some of the big items you&rsquo;ll run into when looking at your diffs after running the Xcode automatic migration. <\/p><\/blockquote>\n\n<p><a href=\"http:\/\/www.cocoawithlove.com\/blog\/2016\/09\/14\/updating-cocoawithlove.html\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.cocoawithlove.com\/blog\/2016\/09\/14\/updating-cocoawithlove.html\"><p>This article is my response to the question of the week: &ldquo;how much work is involved in migrating to Swift 3?&rdquo;<\/p>\n<p>[&#8230;]<\/p>\n<p>I really wish I could say anything in this article [Exponential time complexity in the Swift type checker] had changed but the compiler issues described all remain exactly as is.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/www.natashatherobot.com\/swift-3-0-refactoring-cues\/\">Natasha Murashev<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.natashatherobot.com\/swift-3-0-refactoring-cues\/\"><p>So although the Swift 3.0 upgrade is very painful, it is also a good time to notice all those repetitive things in your code and refactor.<\/p><\/blockquote>\n\n<p><a href=\"http:\/\/ericasadun.com\/2016\/09\/15\/swift-from-two-to-three-on-itunes-and-leanpub\/\">Erica Sadun<\/a>:<\/p>\n<blockquote cite=\"http:\/\/ericasadun.com\/2016\/09\/15\/swift-from-two-to-three-on-itunes-and-leanpub\/\"><p>Swift 3 is a major, breaking language change. Are you ready to make the jump? Let &ldquo;Swift from Two to Three&rdquo; help you along the way. From migrating your code, updating your style, and adopting new Swift features, this book ushers you into the newly refreshed language. Learn what changed, why it changed, and how you can update your code using this hands-on guide that covers all the major difference with plenty of examples and insight.<\/p><\/blockquote>\n\n<p>There&rsquo;s a <a href=\"https:\/\/www.reddit.com\/r\/swift\/comments\/53ebke\/any_lessons_learned_migrating_to_swift_3_and_how\/\">Reddit thread<\/a> about people&rsquo;s experiences updating.<\/p>\n\n<p>Update (2016-09-28): <a href=\"http:\/\/useyourloaf.com\/blog\/swift-3-access-controls\">Keith Harrison<\/a>:<\/p>\n<blockquote cite=\"http:\/\/useyourloaf.com\/blog\/swift-3-access-controls\"><p>Swift 3 has brought us some interesting access control changes. The differences between <code>open<\/code> and <code>public<\/code> or <code>private<\/code> and <code>fileprivate<\/code> take some getting used to. Luckily unless you are writing a framework the new rules are simple. Here is what you need to know.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Ted Kremenek (Hacker News): Swift 3.0, the first major release of Swift since it was open-sourced, is now officially released! Swift 3 is a huge release containing major improvements and refinements to the core language and Standard Library, major additions to the Linux port of Swift, and the first official release of the Swift Package [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[131,69,31,46,30,71,901,258],"class_list":["post-15776","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-cocoa","tag-ios","tag-languagedesign","tag-mac","tag-programming","tag-swift-programming-language","tag-unicode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=15776"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15776\/revisions"}],"predecessor-version":[{"id":15840,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/15776\/revisions\/15840"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=15776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=15776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=15776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}