第1期
UIStoryboardSegue有一个令人烦恼的缺陷:它的sourceViewController和destinationViewController属性的键入方式为
AnyObject!(即使在Objective-C(Id类型)中也是如此),而不是
UIViewController应该的方式。
相同的缺陷会给您的完美和简单的代码造成破坏。这是重写它的方法,以修复编译错误:
@objc(SEPushNoAnimationSegue)class SEPushNoAnimationSegue: UIStoryboardSegue { override func perform () { let src = self.sourceViewController as UIViewController let dst = self.destinationViewController as UIViewController src.navigationController.pushViewController(dst, animated:false) }}注:苹果在iOS中9固定这个东西
sourceViewController和
destinationViewController现在被正确声明为
UIViewController。
第2期
Swift编译器使用其自己的名称mangling来存储其符号,并且很好的,Objective-
C在Xpre中无法识别它。使用显式即可
@obj()解决问题。



