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

Summary

While protocols themselves may not seem very exciting, they are actually quite powerful. As we saw in this chapter, we are able to use them to create very specific requirements. We can then use protocol inheritance and protocol composition to create protocol hierarchies. We also saw how to implement the delegation patterns with protocols.

We concluded the chapter by showing how we can model a robot with sensors using the protocol and how Apple uses protocols in the Swift standard library.

In Chapter 3, Extensions, we will see how we can use protocol extensions to add functionality to types that conform to a protocol but before we do that, let's look at our type choices.

主站蜘蛛池模板: 常山县| 师宗县| 新河县| 崇义县| 长岭县| 浦东新区| 揭阳市| 满城县| 平和县| 蓬安县| 海兴县| 大厂| 长泰县| 金川县| 泰来县| 工布江达县| 独山县| 怀仁县| 中宁县| 辽中县| 临澧县| 鹤岗市| 如东县| 秦皇岛市| 三门县| 分宜县| 高安市| 临清市| 台州市| 万年县| 宜黄县| 兰溪市| 长海县| 彰化市| 安龙县| 南部县| 乌什县| 永登县| 永登县| 涟源市| 洞口县|