Cannot assign value of type '() -> Void' to type '(() -> Void)!'

前端 未结 1 1089
长情又很酷
长情又很酷 2020-12-07 03:44

after updating to xcode 8 beta 6, I\'m getting the error

Cannot assign value of type \'() -> Void\' to type \'(() -> Void)!\'

o

相关标签:
1条回答
  • 2020-12-07 04:25

    It seems your issue is related to this: SE-0103

    Try chaging the method header of your addButton(_:action:) to:

    public func addButton(_ title:String, action:@escaping ()->Void)->SCLButton {
    

    The diagnostic messages from new betas are so confusing and inadequate as usual, but making your property simply non-Optional var action:()->Void = {} will give you a little more useful info.

    0 讨论(0)
提交回复
热议问题