此代码生成段错误:编译时出现 11 错误:
class Test: UICollectionViewLayout {
var sublayout: Sublayout?
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
sublayout?.shouldInvalidate?(forNewBounds: newBounds, currentBounds: collectionView!.bounds)
return true
}
}
@objc protocol Sublayout {
@objc optional func shouldInvalidate(forNewBounds: CGRect, currentBounds: CGRect)
}
有什么想法吗?
最佳答案
仅供引用,在将我的 Swift 2.2 iOS 应用程序转换为 Swift3/Xcode8 后,我遇到了段错误 11。在 2.2 下,该应用程序编译时没有错误或警告,因此我认为 S3/XC8 尚未准备好进行实际工作。
关于swift - Xcode 8 Swift 3 段错误 : 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39668446/