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

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.

主站蜘蛛池模板: 武强县| 泾源县| 周宁县| 互助| 合阳县| 竹北市| 阳高县| 嘉峪关市| 镇沅| 青海省| 罗源县| 苏尼特左旗| 平泉县| 浪卡子县| 樟树市| 稷山县| 文水县| 洛扎县| 独山县| 汾阳市| 永春县| 日土县| 波密县| 长武县| 拜城县| 和政县| 卓资县| 武强县| 岳西县| 霍城县| 萨嘎县| 陇川县| 保靖县| 晋宁县| 桃园县| 酉阳| 嵩明县| 正镶白旗| 合江县| 宜川县| 张家口市|