使用闭包来进行 Storyboard 的 segues
PrettySegue 通过 CocoaPods 提供。要安装它,简单地将以下行添加到 Podfile 中:
pod "PrettySegue"
如果您在 Storyboard 中创建了一个名为“area”的 segue,您可以像这样执行 segue:
import PrettySegue
class ViewController: UIViewController {
// basic
@IBAction func onBtnA(sender: AnyObject) {
performSegue(withIdentifier: "area", sender: self) { (areaVC: AreaViewController) in
areaVC.height = 10
areaVC.width = 10
}
}
}
PrettySegue 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。