官术网_书友最值得收藏!

Protocols

A protocol defines signatures or types of methods, properties, and other requirements that fit to a specific task or piece of functionality. The protocol doesn't actually implement any functionality. It only describes what an implementation will look like. A class, structure, or enumeration that provides an actual implementation of requirements can adopt the protocol. Protocols use the same syntax as normal methods but are not allowed to specify default values for method parameters.

The is operator can be used to check whether an instance conforms to a protocol. We can check for protocol conformance only if our protocol is marked with @objc for classes. The as operator can be used to cast to a specific protocol.

主站蜘蛛池模板: 湘潭市| 丹棱县| 泰州市| 丽水市| 本溪市| 三亚市| 铜陵市| 武川县| 万盛区| 从化市| 米易县| 和顺县| 安达市| 宜川县| 东乌珠穆沁旗| 射洪县| 多伦县| 嘉善县| 洪江市| 德格县| 新野县| 五莲县| 宁化县| 昌邑市| 津南区| 扎囊县| 邻水| 扶余县| 曲周县| 威信县| 道真| 来宾市| 荆门市| 锡林郭勒盟| 青铜峡市| 沙坪坝区| 河曲县| 那曲县| 建宁县| 若尔盖县| 洪泽县|