From 4f4cc171e7d24d4637bdbead7496848f228a4bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=BD=A6=E5=8D=9A?= Date: Wed, 14 Sep 2016 09:56:06 +0800 Subject: [PATCH] Update to swift 3.0 final (#647) --- source/chapter2/05_Control_Flow.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/chapter2/05_Control_Flow.md b/source/chapter2/05_Control_Flow.md index 3e598bb4..665d366a 100755 --- a/source/chapter2/05_Control_Flow.md +++ b/source/chapter2/05_Control_Flow.md @@ -770,3 +770,11 @@ if #available(iOS 10, macOS 10.12, *) { 在它一般的形式中,可用性条件使用了一个平台名字和版本的列表。平台名字可以是`iOS`,`macOS`,`watchOS`和`tvOS`——请访问[声明属性](../chapter3/06_Attributes.html)来获取完整列表。除了指定像 iOS 8的主板本号,我们可以指定像iOS 8.3 以及 macOS 10.10.3的子版本号。 +```swift +if #available(platform name version, ..., *) { + statements to execute if the APIs are available +} else { + fallback statements to execute if the APIs are unavailable +} +``` +