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

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.

主站蜘蛛池模板: 仙游县| 始兴县| 南昌县| 高平市| 台江县| 阿尔山市| 师宗县| 广西| 牡丹江市| 犍为县| 天祝| 亳州市| 枣庄市| 门头沟区| 彭阳县| 原阳县| 集安市| 蒲城县| 呼玛县| 西乡县| 六安市| 昌平区| 全椒县| 新安县| 米泉市| 苗栗县| 宁波市| 雷州市| 花垣县| 赣州市| 湖州市| 平乡县| 山阳县| 阿坝县| 成都市| 苍溪县| 合江县| 涿鹿县| 汉阴县| 维西| 江阴市|