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

Refreshing the Basics

In order to properly kick-start our journey through Swift's best practices and design patterns, I believe it's important that we take some time to go back to the basics. It's important to always keep your foundation strong; the more we advance through this book, the more we'll rely on those concepts.

I'll assume that you have a proper understanding of object-oriented programming (OPP) fundamentals, classes, inheritance, composition, and other techniques, as well as a fundamental understanding of the differences between value and reference types. If you're rusty on these concepts, you shouldn't worry too much, as we'll cover them shortly.

This chapter will dive deeply into the Swift language. What is a struct, and what is a class? What are their differences? Should you use an enum or an OptionSet? All of these questions will be answered in this chapter. We'll go back to the basics of classes and inheritance, and we'll discover the power of value types and immutability. We'll look it functions, closures, and currying. If you're unfamiliar with these constructs, or if you just want to get a refresher, you should tag along as we go back to the basics. These basics are essential to the Swift language, and are required to successfully apply efficient design patterns and best practices.

In this first chapter, we'll take the time to go back to the basics by covering the following topics:

  • Classes and structs: what they are, and how they behave
  • Exploring enums and their capabilities and extensibility
  • Getting functional with closures and functions
  • Introducing protocols and scratching the surface of extending protocols
  • Concluding with other useful language constructs, such as type aliases, tuples, and generics
主站蜘蛛池模板: 浙江省| 子洲县| 廊坊市| 观塘区| 许昌市| 张家川| 佛山市| 阿瓦提县| 远安县| 丹寨县| 司法| 河曲县| 佳木斯市| 天祝| 新竹市| 周宁县| 保康县| 安徽省| 三门县| 鹤壁市| 瑞丽市| 嘉黎县| 嘉禾县| 海阳市| 图们市| 大丰市| 金平| 嘉义市| 赤峰市| 海晏县| 东阳市| 高阳县| 油尖旺区| 永丰县| 新闻| 大悟县| 漾濞| 临潭县| 冕宁县| 姜堰市| 鄄城县|