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

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.

主站蜘蛛池模板: 合肥市| 竹山县| 云霄县| 广南县| 肃宁县| 沭阳县| 隆安县| 潜江市| 托里县| 新余市| 阜新市| 哈巴河县| 祥云县| 南靖县| 榆树市| 紫阳县| 丹棱县| 长春市| 镇康县| 静安区| 墨江| 阆中市| 静宁县| 外汇| 科尔| 峡江县| 蒙山县| 阿巴嘎旗| 沧州市| 泽普县| 长海县| 沙河市| 荣成市| 天全县| 江油市| 镇安县| 鄢陵县| 凤凰县| 石阡县| 宜丰县| 方正县|