<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":491242,"date":"2017-04-01T05:10:00","date_gmt":"2017-04-01T03:10:00","guid":{"rendered":"http:\/\/nhub.news\/?p=491242"},"modified":"2017-04-01T05:22:53","modified_gmt":"2017-04-01T03:22:53","slug":"swift-3-1-improves-language-package-manager-and-linux-implementation","status":"publish","type":"post","link":"http:\/\/nhub.news\/de\/2017\/04\/swift-3-1-improves-language-package-manager-and-linux-implementation\/","title":{"rendered":"Swift 3.1 Improves Language, Package Manager, and Linux Implementation"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>Staying true to its plan, the recently announced Swift 3.1 is source compatible with Swift 3.0. Still, it includes a number of changes to the language, the standard library, and improved Linux implementation.<\/b> <br \/>Staying true to its plan, the recently announced Swift 3.1 is source compatible with Swift 3.0. Still, it includes a number of changes to the language, the standard library, and improved Linux implementation. <br \/>On the language front, two new members have been added to the Sequence protocol: drop(while:) and prefix(while:). They return the subsequence obtained by dropping or including the initial elements of a sequence while a given predicate is true. So, if you have a sequence s , you can take its n-th to m-th subsequence by executing: <br \/>Swift 3.1 also adds a number of conversion initializers for all numeric types, including Int , Float , and Double types, which either produce a correct result, or return nil. Failable initializers, as they are called, are meant to better address conversion from loosely typed data, such as those represented in a JSON format. All numeric types have thus a new initializer that uses the exactly keyword, e.g., <br \/>Having initializers that can fail has been preferred to initializers that can throw an exception based on community feedback . <br \/>Not mentioned in the official announcement, but documented in the updated Apple\u2019s guide to Swift 3.1 , type extension can now include a generic where clause: <br \/>Previously, the where clause could only be used to constrain a generic to a given protocol, which could lead to introducing ad-hoc protocol only used to specify that constraint: <br \/>As a final note about the language, Swift 3.1 extends the @available attribute so it allows to express availability by Swift version , whereas it previously only allowed to specify availability by language and platform: <br \/>This relieves programmers from using conditional compilation to juggle with alternate versions of functions, declarations, etc. <br \/>The Linux implementation of Swift has seen improvements to many existing classes, including NSDecimal , URLSession , NSArray , NSData , improved JSON serialization performance, and many others. <br \/>Finally, the Swift Package Manager has got a number of awaited features, such as: <br \/>Swift 3.1 is available through Xcode 8.3 on macOS, a binary distribution for Ubuntu , and as source code for other platforms from GitHub .<\/p>\n<p><span>\u00a9 Source: <a href=\"http:\/\/www.infoq.com\/news\/2017\/03\/swift-31-released?utm_campaign=infoq_content&amp;utm_source=infoq&amp;utm_medium=feed&amp;utm_term=news\" target=\"_blank\">http:\/\/www.infoq.com\/news\/2017\/03\/swift-31-released?utm_campaign=infoq_content&amp;utm_source=infoq&amp;utm_medium=feed&amp;utm_term=news<\/a><br \/>\nAll rights are reserved and belongs to a source media.<\/span><\/p>\n<script>jQuery(function(){jQuery(\".vc_icon_element-icon\").css(\"top\", \"0px\");});<\/script><script>jQuery(function(){jQuery(\"#td_post_ranks\").css(\"height\", \"10px\");});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>Staying true to its plan, the recently announced Swift 3.1 is source compatible with Swift 3.0. Still, it includes a number of changes to the language, the standard library, and improved Linux implementation. Staying true to its plan, the recently announced Swift 3.1 is source compatible with Swift 3.0. Still, it includes a number of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":491241,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/posts\/491242"}],"collection":[{"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/comments?post=491242"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/posts\/491242\/revisions"}],"predecessor-version":[{"id":491243,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/posts\/491242\/revisions\/491243"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/media\/491241"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/media?parent=491242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/categories?post=491242"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/de\/wp-json\/wp\/v2\/tags?post=491242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}