the-swift-programming-language-in-chinese icon indicating copy to clipboard operation
the-swift-programming-language-in-chinese copied to clipboard

更新swift5.9.2 对可选协议的描述

Open renjwjx opened this issue 1 year ago • 0 comments

根据Apple 官方文档 https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols#Optional-Protocol-Requirements Both the protocol and the optional requirement must be marked with the @objc attribute. Note that @objc protocols can be adopted only by classes, not by structures or enumerations.

可选协议只可以被class 遵守,并不需要class继承NSObject 或者标记@objc.

renjwjx avatar Dec 14 '23 06:12 renjwjx