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

Class-only protocols

We mentioned before that classes, structures, and enumerations could adopt protocols. The difference among them is that classes are reference types, whereas structures and enumerations are value types. If you find yourself having some specific actions that will be done only via reference types, mark it as class only. To do so, just mark it as follows:

protocol ClassOnlyProtocol: class{ 
   // class only properties and methods go here 
} 

Add a colon : and the class keyword to mark your protocol as class only.

主站蜘蛛池模板: 榆社县| 阳东县| 贵南县| 台山市| 望谟县| 合山市| 平乐县| 贵溪市| 永安市| 葫芦岛市| 静乐县| 浮梁县| 保定市| 城步| 沙河市| 昌吉市| 芦溪县| 图木舒克市| 二手房| 定边县| 海晏县| 长沙市| 南靖县| 游戏| 封开县| 天津市| 莱阳市| 太保市| 临江市| 永胜县| 丽江市| 喀喇沁旗| 来宾市| 剑川县| 岗巴县| 南平市| 炎陵县| 东兴市| 通城县| 新邵县| 周宁县|