概述 var finishBlock: ((_ mm :String )->String)? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. // 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 } 总结
以上是内存溢出为你收集整理的swift中block的简单使用全部内容,希望文章能够帮你解决swift中block的简单使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
评论列表(0条)