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

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.

主站蜘蛛池模板: 乐业县| 昭觉县| 邓州市| 额济纳旗| 吴江市| 常熟市| 门源| 仙桃市| 漠河县| 改则县| 桃源县| 旅游| 封开县| 虹口区| 星座| 荥阳市| 通州区| 白河县| 张家界市| 疏附县| 望江县| 安龙县| 额济纳旗| 太康县| 昭平县| 甘肃省| 当雄县| 海原县| 滦平县| 高平市| 辽源市| 安达市| 安西县| 高尔夫| 祁连县| 隆尧县| 乐都县| 阳江市| 梁山县| 垦利县| 锡林浩特市|