Swift compiler segmentation fault when building

后端 未结 30 2664
南旧
南旧 2020-11-29 03:59

Adding a (convenient) computed height property to UIView in my UIViewExtension.swift file is causing the Swift compiler to segfault...

30条回答
  •  半阙折子戏
    2020-11-29 05:06

    I got this error while extending one of my protocols and mistyped and optional type argument.

    protocol SomeProtocolName: class {
        var someProtocolVariable: String { get set }
    
        func someProtocolFunction(someProtocolVariable: String)
    }
    
    // MARK:
    extension SomeProtocolName {
        func someProtocolFunction(someProtocolVariable: String?) {
            self.someProtocolVariable = someProtocolVariable
        }
    }
    

    The difference in function arguments String in prototype and String? in extension caused Segmentation Fault 11.

提交回复
热议问题