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

Getting ready

The syntax of protocol goes like this:

protocol ProtocolName{ 
   // List of properties and methods goes here.... 
} 

The keyword protocol followed by the protocol name and curly braces are the building blocks of any protocol you need to write. Classes, structures, or enumeration can then conform to it like this:

class SampleClass: ProtocolName{ 
} 

After class name, you type colon and the super class name that this class extend from if any, followed by a list of protocols that you want to conform to with a comma separation.

主站蜘蛛池模板: 四子王旗| 石城县| 资兴市| 紫金县| 乌兰县| 梨树县| 巨野县| 衡水市| 榆树市| 从江县| 桂平市| 威海市| 渝北区| 志丹县| 临夏县| 洛浦县| 改则县| 华蓥市| 临邑县| 新郑市| 临海市| 法库县| 油尖旺区| 东辽县| 思茅市| 龙州县| 舒城县| 香港| 偏关县| 岗巴县| 平阴县| 达日县| 积石山| 闵行区| 栖霞市| 甘肃省| 梅河口市| 雅安市| 铜陵市| 伊金霍洛旗| 金堂县|