标签:cape nbsp UNC parameter param after delay 异步 bsp
新版的Swift闭包做参数默认是@noescaping,不再是@escaping。所以如果函数里异步执行该闭包,要添加@escaping。否则报错:Closure use of non-escaping parameter ‘xxx‘ may allow it to escape.
func delay(seconds: Double, completion: @escaping () -> Void) { DispatchQueue.main.asyncAfter(deadline: .now() + seconds) { completion() } }
Closure use of non-escaping parameter 'xxx' may allow it to escape
标签:cape nbsp UNC parameter param after delay 异步 bsp
原文地址:https://www.cnblogs.com/liuyongfa/p/10411441.html