【发布时间】:2015-10-03 07:47:14
【问题描述】:
我有一个带有 defer 块的简单代码块,但 Playground 没有执行 defer 块。我究竟做错了什么?
打印以下内容: “第1步” “第 3 步” “第4步” “第五步”
import UIKit
print("Step 1")
do {
defer { print("Step 2") }
print("Step 3")
print("Step 4")
}
print("Step 5")
【问题讨论】:
-
你确定吗?为我工作。
-
对我来说,它在项目中工作,但在操场上没有工作。
标签: ios xcode swift swift2 ios9