swift中block的简单使用

前端之家收集整理的这篇文章主要介绍了swift中block的简单使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
var finishBlock: ((_ mm :String )->String)? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,typically from a nib. // load { (msg) -> String in // // return "hahh" // } // self.finishBlock!("hhah") finishBlock = {(msg)->String in return "你好" }; let kj = finishBlock!("kkk") // print(kj) } func load(successed: @escaping (_ text :String )->String) { self.finishBlock = successed } 原文链接:https://www.f2er.com/swift/322337.html

猜你在找的Swift相关文章