implicit return in a closure causing an error

前端 未结 2 923
情书的邮戳
情书的邮戳 2020-12-12 06:10
Error: Cannot convert the expression type (String, MyType) to ()

From the following code

Test(method: {[weak self] (message: String         


        
2条回答
  •  不知归路
    2020-12-12 06:19

    The implicit return is returning the result of your callback() method. That return value conflicts with the closure's return value of void. You thus need an explicit, if ugly, return.

提交回复
热议问题