Swift中閉包反向傳值閉包
1.第二控制器申明一個閉包類型spa
typealias BackBlock = (String) -> Void
2.第二控制器定義一個變量code
var BackBlockClousure : BackBlock?
3.第一控制器實現回調blog
let VC = segue.destination as! DetailsViewController VC.BackBlockClousure = { (backStr:String) -> Void in NSLog(backStr, "") }
4.第二控制器傳值io
self.BackBlockClousure!("反向傳值" + area.name)