Swift 3.1 发布,包含对标准库的改进
2017-04-07 19:07
239 查看
来源:oschina-局长
www.oschina.net/news/83314/swift-3-1-released
Swift 3.1 已经正式发布了,Swift 3.1 是一个小更新版本,包含对标准库的改进。由于 IBM 和社区其他成员的努力,该版本还包括许多关于 Swift 的 Linux 实现的更新。还有一些 Swift 包管理器的更新。
此外,Swift 3.1 编译器现在可以自动预编译 Objective-C 桥接头,还可以加快混合源代码项目的调试配置构建。
语言更新:
Swift 3.1 与 3.0 兼容,它包含以下的更改和更新,其中大部分都经历了 Swift Evolution process:
新的 Sequence 协议成员
Sequence 协议现在有两个新成员:
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
}
查看更多:SE-0045: Add prefix(while:) and drop(while:) to stdlib
https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md
Swift 版本的可用性
Swift 3.1 扩展了 @availability 属性以使用 Swift 版本来指示声明的生命周期。例如,在 Swift 3.1 中删除的 API 将被写为:
@available(swift, obsoleted: 3.1)
class Foo {
//...
}
查看更多:SE-0141: Availability by Swift version
https://github.com/apple/swift-evolution/blob/master/proposals/0141-available-by-swift-version.md
Linux 实现的改进:
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
包管理器更新
可编辑的包
默认情况下,软件包的依赖性存储在工具管理的构建目录中,并且新的 swift package edit 命令允许用户在软件包上 “开始编辑”,将其移动到用户的控制下(进入软件包目录),免除依赖更新,允许用户提交并推送对该包的更改。
查看更多:SE-0082: Package Manager Editable Packages
https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md
更新内容较多,详情请参阅发布主页
https://swift.org/blog/swift-3-1-released/
www.oschina.net/news/83314/swift-3-1-released
Swift 3.1 已经正式发布了,Swift 3.1 是一个小更新版本,包含对标准库的改进。由于 IBM 和社区其他成员的努力,该版本还包括许多关于 Swift 的 Linux 实现的更新。还有一些 Swift 包管理器的更新。
此外,Swift 3.1 编译器现在可以自动预编译 Objective-C 桥接头,还可以加快混合源代码项目的调试配置构建。
语言更新:
Swift 3.1 与 3.0 兼容,它包含以下的更改和更新,其中大部分都经历了 Swift Evolution process:
新的 Sequence 协议成员
Sequence 协议现在有两个新成员:
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
}
查看更多:SE-0045: Add prefix(while:) and drop(while:) to stdlib
https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md
Swift 版本的可用性
Swift 3.1 扩展了 @availability 属性以使用 Swift 版本来指示声明的生命周期。例如,在 Swift 3.1 中删除的 API 将被写为:
@available(swift, obsoleted: 3.1)
class Foo {
//...
}
查看更多:SE-0141: Availability by Swift version
https://github.com/apple/swift-evolution/blob/master/proposals/0141-available-by-swift-version.md
Linux 实现的改进:
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
包管理器更新
可编辑的包
默认情况下,软件包的依赖性存储在工具管理的构建目录中,并且新的 swift package edit 命令允许用户在软件包上 “开始编辑”,将其移动到用户的控制下(进入软件包目录),免除依赖更新,允许用户提交并推送对该包的更改。
查看更多:SE-0082: Package Manager Editable Packages
https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md
更新内容较多,详情请参阅发布主页
https://swift.org/blog/swift-3-1-released/
相关文章推荐
- Swift3.1 正式发布,你还在等什么?
- Swift3.1 正式发布,你还在等什么?
- Swift 1.2 正式发布 - 带来很多重大改进
- AppCode 3.1 EAP发布,对Swift的支持有待进一步提高
- AppCode 3.1正式发布,完善对Swift的支持,功能更丰富
- 一篇文章帮你彻底了解 Swift 3.1 的新内容
- Swift中如何化简标准库中冗长的类实例初始化代码
- go-wingui 2018 全新 v2.0 版本发布,包含重大更新!
- 编程之美3.1字符串一位包含的问题Java版
- Swift3.1二维码的生成与扫描
- 終于解決调用wordpress 4.3 xmlrpc api 发布包含分类的文章时返回“抱歉,文章类型不支持您的分类法”错误的問題
- 欲善其事,必利其器 - Librame Utility 3.5.12.0508 实用工具包发布(包含源代码)
- Swift 3.1聊天界面键盘效果的实现详解
- 项目自动化之道-4.按键发布Bat版的jar打包改进
- Swift基础3.1——构造函数
- 《威博文件管理系统》3.1版发布了
- 苹果编程语言 Swift 2.2 发布:支持 Ubuntu Linux 系统
- Apache Commons Math 3.1 发布
- 我国首份IP地理信息标准库发布