Files
the-swift-programming-langu…/source/chapter1/02_version_compatibility.md
rain2540 47598b3c8e Patch 1 (#927)
* Update contributors.md

* 校对: chapter2/03_Strings_and_Characters 方法名变化 (#921)

index(of:) 已更名为: firstIndex(of:)

* Update 01_The_Basics.md

* fix invalid url (#923)

* test gitbook anchor

* Revert "test gitbook anchor"

This reverts commit e82cea3866.

* Update 21_Protocols.md (#924)

* Update 25_Access_Control.md (#925)

* Update 02_version_compatibility.md
2019-05-03 18:58:57 -05:00

11 lines
821 B
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 版本兼容性
本书描述的是在 Xcode 10.2 中的默认 Swift 版本 Swift 5。你可以使用 Xcode10.2 来构建 Swift 5、Swift 4.2 或 Swift 4 写的项目
当您使用 Xcode 10.2 构建 Swift 4 和 Swift 4.2 代码时,除了下面的功能仅支持 Swift 5其他大多数功能都依然可用。
* **try?** 表达式不会为已返回可选类型的代码引入额外的可选类型层级。
* 大数字的整型字面量初始化代码的类型将会被正确推导,例如 **UInt64(0xffff_ffff_ffff_ffff)** 将会被推导为整型类型而非溢出。
用 Swift 5 写的项目可以依赖用 Swift 4.2 或 Swift 4 写的项目反之亦然。这意味着如果你将一个大的项目分解成多个框架framework你可以每次一个框架地迁移 Swift 4 代码到 Swift 5。