Swift 3.1正式發佈

Swift 3.1在今(2017/3/28)正式發佈!3.1是次要的更新版本,主要針對目前的標準函式庫做改善以及改進。
在IBM以及各社群成員的努力下,還包含了Swift on LINUX的更新。以及部份的Swift Package Manager更新~
此外在編譯器也加上預編譯Objective-C的功能,讓編譯速度加快~

更多訊息可參考原始文章
https://swift.org/blog/swift-3-1-released/

 

 

New Sequence protocol members

The Sequence protocol now has two new members:

protocol Sequence {
  // ...
  /// Returns a subsequence by skipping elements while `predicate` returns
  /// `true` and returning the remainder.
  func drop(while predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.SubSequence
  /// Returns a subsequence containing the initial elements until `predicate`
  /// returns `false` and skipping the remainder.
  func prefix(while predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.SubSequence
}

See more at: SE-0045: Add prefix(while:) and drop(while:) to stdlib

Availability by Swift version

Swift 3.1 extends the @availability attribute to use the version of Swift to indicate the lifecycle of a declaration. As an example, an API that is removed in Swift 3.1 would be written as:

@available(swift, obsoleted: 3.1)
class Foo {
  //...
}

See more at: SE-0141: Availability by Swift version

Improved numeric conversion initializers

Swift 3.1 adds a new family of conversion initializers to all numeric types that either complete successfully without loss of information or return nil.

See more at: SE-0080: Failable Numeric Conversion Initializers

Deprecation and replacement of UnsafeMutablePointer.initialize(from:)

The version of UnsafeMutablePointer.initialize(from:) that takes a Collection is deprecated in favor of a new method on UnsafeMutableBufferPointer that takes a Sequence, with a goal of improving memory safety and enabling faster initialization of memory from sequences.

See more at: SE-0147: Move UnsafeMutablePointer.initialize(from:) to UnsafeMutableBufferPointer

Improvements to the Linux implementation

  • Implementation of NSDecimal
  • Implementation of NSLengthFormatter
  • Implementation of Progress
  • Many improvements to URLSession functionality, including API coverage and optimized usage of libdispatch
  • Improved API coverage in NSArray, NSAttributedString and many others
  • Significant performance improvements in Data. See more details here
  • Improved JSON serialization performance
  • Memory leaks fixed in NSUUID, NSURLComponents and others
  • Improved test coverage, especially in URLSession

Package Manager Updates

Editable packages

Package dependencies are now stored in the tool-managed build directory by default, and a new swift package edit command allows users to “begin editing” on a package, moving it under the user’s control (into the Packages directory), exempting it from dependency updates, and allowing the user to commit and push changes to that package.

See more at: SE-0082: Package Manager Editable Packages

Version pinning

The version of each dependency you’ve used is now recorded in a Package.pins file, which can be checked in to share those versions with other users of your package; swift package pin and swift package unpin commands provide further control. The pinned versions of a package’s dependencies are fetched by default when resolving dependencies, but swift package update will re-resolve to the latest allowable dependency versions and update the pinfile.

See more at: SE-0145: Package Manager Version Pinning

Tools version

Packages can now specify the minimum version of the Swift tools that they require. This requirement can be edited with the swift package tools-version command and is recorded at the top of the Package.swift manifest. Package versions which require newer Swift tools than those in use will be ignored by dependency resolution, so packages can adopt new Swift features without breaking clients who are using older Swift tools. The minimum tools version required determines which Swift language version is used to interpret the Package.swift manifest, and which version of the PackageDescription API is available.

See more at: SE-0152: Package Manager Tools Version

Swift language compatibility version

Packages can now specify whether their sources are written in the Swift 3 or Swift 4 language version. If not specified, a default is inferred from the Package’s minimum Swift tools version.

See more at: SE-0151: Package Manager Swift Language Compatibility Version

Other Package Manager improvements

  • Package dependency resolution is now correct in cases where it could have resolved to incorrect dependency versions previously. Dependency cycles are now detected during a build, and incremental builds will rebuild fewer sources when possible.
  • swift test now supports running tests in parallel with the --parallel flag. swift build, swift test, and all swift package commands which resolve dependencies now support fetching those dependencies in parallel with the --enable-prefetching flag.

Documentation for the Swift Package Manager can be found in the repository.

Migrating to Swift 3.1

Swift 3.1 is source compatible with Swift 3.0. To help with moving to Swift 3.1 from earlier releases of Swift, Xcode 8.3 contains a code migrator that can automatically handle many of the need source changes. There is also a migration guide available to guide you through many of the changes — especially through the ones that are less mechanical and require more direct scrutiny.

Documentation

An updated version of The Swift Programming Language for Swift 3.1 is now available on Swift.org. It is also available for free on Apple’s iBooks store.

Platforms

Linux (Ubuntu 14.04, Ubuntu 16.04 and Ubuntu 16.10)

Official binaries for Ubuntu 14.04, Ubuntu 16.04 and Ubuntu 16.10 are available for download.

Apple (Xcode)

For development on Apple’s platforms, Swift 3.1 ships as part of Xcode 8.3.

Sources

Development on Swift 3.1 was tracked in the swift-3.1-branch on the following repositories on GitHub:

The tag swift-3.1-RELEASE designates the specific revisions in those repositories that make up the final version of Swift 3.1.

The swift-3.1-branch will remain open, but under the same release management process, to accumulate changes for a potential future bug-fix “dot” release.

Swift 教學、學習資源

Swift 2做了些改變,像是 do while變成了 repeat while、for in 加上了where成了 for in where、switch 多了range跟pattern外也多了個 if case、多了個guard(類似if);接下來在exception例外處理有個 do catch…..然後println與print整合了,變成了 print(“”,appendNewline: false)。

學習資源:
美國史丹佛大學著名的ios開發教學線上課程 http://web.stanford.edu/class/cs193p/cgi-bin/drupal/
Apple 官方Swift Bloghttps://developer.apple.com/swift/blog/
Apple Swift 2.1官方文件 https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/
iOS開發者及作家 彼得潘 http://www.slideshare.net/deeplovepan/swift-51667357

大陸 Swift開發課程(中文) http://www.hcxy.me/

大陸開發者 王巍 http://swifter.tips/ http://onevcat.com/#blog

Apple資源 https://developer.apple.com/library/ios/navigation/

史丹佛大學2015年免費iOS開發課程也使用swift語言

美國史丹佛大學從2010年開始就開設了CS193P的網路iOS開發課程,也成了許多開發入門新手的必看聖經之一。今年(2015年)也有新的版本,也採用了swift/XCode6做為新的教學語言。

由於Apple發表新的語言-Swift後,就致力在推廣這個比Objective-C擁有更多優點的語言,所以大部份的學校也開始跟隨apple腳步轉向swift,想要從事iOS開發的朋友也不要錯過這個課程。

 

課程連結:

Apple WWDC2014發表Swift語言

一向以Objective-C為主要開發語言的Apple,在這次的WWDC發表了新的語言-Swift。似乎是要取代Objective-C成為新一代的開發語言,擁有更精簡、易讀、高效率的語言。

如果有興趣的朋友可下載Xcode6 Beta試用

 

延伸閱讀:

Apple Swift编程语言入门教程

来自苹果的编程语言——Swift简介

The Swift Programming Language

Using Swift with Cocoa and Objective-C

Swift網站 https://developer.apple.com/swift/

Swift電子書 https://itunes.apple.com/us/book/the-swift-programming-language/id881256329?mt=11

http://swift-lang.org/

舊Apple機器免費取得iWork/iLife方式

Apple這次除了作業系統是免費之外,iWork/iLife也免費下載(不過殘念的一點是新機才可以)。

昨天開始就有人找到了bug(應該是)

1要先有(或安裝零售版、光碟版)的舊版iWork/iLife,試用版的也行。

2接著到語言與地區,把偏好的語言的English用拖拉的方式拉到繁體中文上面去(如圖)

螢幕快照 2013-10-24 10.25.07 AM

3接著重新開機,進入Apple Store就發現神奇的事情

Screen Shot 2013-10-24 at 10.27.19 AM

要下載要快 🙂

Apple宣佈新版OS X系統Mavericks免費取得~作業系統免費時代來臨

螢幕快照 2013-10-23 上午10.13.24

今天凌晨Apple發表會中,除了新版的iPad Air、iPad Mini外,最讓人關切的莫過於新版本的OS X Mavericks是免費取得,雖然不會是跨世代的創舉(因為原本Linux及其他OpenSource系統原本就免費),不過對一向以作業系統做為很大獲利來源的微軟無非是重重的打擊,免費作業系統時代只是迎合行動裝置時代來臨的另一種方式。

對於Apple來說,也選擇了主要的獲利點~畢竟它原本就不是軟體公司,所以”免費系統”還是得安裝在它的硬體上倒是成了不錯的策略。

從行動裝置時代來臨就一直失利的微軟來說,接下來要走的路將會更加嚴刻。但對於消費者來說也算是不錯的福音!

 

 

Apple Developer Center System Status

 

自從7/18 蘋果無預警關閉開發者網站後,隨後發佈網站被DDOS攻擊後,似乎是相當嚴重。

可以從 System Status網頁(https://developer.apple.com/support/system-status)看到服務狀態,目前祇有iTunes Connect及Bug Reporter是Online,其他都是OffLine。不知道什麼時候才會維修好!

systemstatus