可选协议

optional protocol

Posted by Genie on June 15, 2020

可选协议通过@objc转换为oc来实现

1
2
3
4
5
6
7
8
9
@objc protocol OptionalProtocol {
    @objc optional func optionalMethod()
    func needMethod()
}

class testss: OptionalProtocol {
    func needMethod() {
    }
}