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

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.

主站蜘蛛池模板: 马鞍山市| 哈密市| 斗六市| 赣州市| 遵义县| 徐闻县| 通州市| 平利县| 静安区| 潜江市| 张家川| 双城市| 黄梅县| 河东区| 宁德市| 眉山市| 革吉县| 互助| 荔浦县| 平武县| 开江县| 施甸县| 和静县| 银川市| 惠来县| 望江县| 通辽市| 化德县| 夏河县| 东海县| 迁西县| 布尔津县| 祁门县| 盐津县| 囊谦县| 阳朔县| 盐山县| 绩溪县| 定结县| 海南省| 顺昌县|