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

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
主站蜘蛛池模板: 丁青县| 灌云县| 武威市| 新田县| 平利县| 高阳县| 乌拉特前旗| 鄂温| 根河市| 阿拉善盟| 米易县| 恩平市| 梅州市| 武穴市| 长兴县| 沙雅县| 新乡县| 海盐县| 芦山县| 桓台县| 凌海市| 乌什县| 筠连县| 芜湖县| 藁城市| 鄂托克旗| 五指山市| 江西省| 岚皋县| 喀喇沁旗| 罗平县| 本溪市| 郎溪县| 错那县| 双牌县| 佛冈县| 莎车县| 碌曲县| 抚宁县| 湾仔区| 余姚市|