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

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.

主站蜘蛛池模板: 金寨县| 武乡县| 巩义市| 竹北市| 铜梁县| 邮箱| 灵山县| 大厂| 长丰县| 会理县| 从化市| 册亨县| 陇西县| 衡水市| 诸城市| 呼和浩特市| 平昌县| 万源市| 德江县| 重庆市| 田林县| 新昌县| 郎溪县| 建湖县| 德清县| 榆中县| 怀柔区| 恩平市| 安阳县| 杭锦旗| 崇左市| 罗平县| 内乡县| 漠河县| 保定市| 镇雄县| 沅江市| 左权县| 文山县| 丰县| 商南县|