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

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.

主站蜘蛛池模板: 读书| 淮滨县| 滨海县| 水富县| 正宁县| 蒲城县| 泰宁县| 淮南市| 唐山市| 宁强县| 汶上县| 扎鲁特旗| 新营市| 常德市| 离岛区| 政和县| 达日县| 凌源市| 当阳市| 莱州市| 祁连县| 子洲县| 营口市| 眉山市| 灵石县| 汪清县| 利津县| 通渭县| 赤水市| 民勤县| 岫岩| 久治县| 金湖县| 高要市| 绥阳县| 华安县| 天气| 乌兰县| 昭平县| 崇左市| 北海市|