在Swift中,如何声明符合协议的变量(或常量)?
我试过了
let whatever: protocol <myProtocol>
Run Code Online (Sandbox Code Playgroud)
和
let whatever: myProtocol
Run Code Online (Sandbox Code Playgroud)
但是在设置它时我得到了错误
Cannot convert the expression's type '()' to type 'myProtocol'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3165 次 |
| 最近记录: |