- Hands-On Design Patterns with Swift
- Florent Vilmart Giordano Scalzo Sergio De Simone
- 186字
- 2021-07-02 14:45:02
Summary
In this chapter, we covered everything that I consider a prerequisite for the rest of this book. We started with classes, the basic building blocks of OOP. You should now be really familiar with them. Structs are unusual constructions for someone coming from OOP, but they are very useful in Swift, as they behave as values, can be immutable, and have other nice properties. With enums, you'll be able to write even more expressive code.
Functions and closures are first-class citizens in Swift, and should be treated as such. Currying is a powerful pattern that lets you reuse functions; in later chapters, you'll see how to use it to write clean code.
The concept of protocols opens the world of protocol extensions and protocol-oriented programming, which is a complex subject. In the following chapters, we'll look at various use cases for implementing particular patterns through protocol extensions.
In the next chapter, we'll focus on memory management and ARC. While value types are not subject to reference counting, classes, functions, and closures interact with each other, and can lead to memory-related crashes and other issues.
- 公有云容器化指南:騰訊云TKE實(shí)戰(zhàn)與應(yīng)用
- Redis應(yīng)用實(shí)例
- 卷積神經(jīng)網(wǎng)絡(luò)的Python實(shí)現(xiàn)
- 新型數(shù)據(jù)庫(kù)系統(tǒng):原理、架構(gòu)與實(shí)踐
- 深度剖析Hadoop HDFS
- 基于Apache CXF構(gòu)建SOA應(yīng)用
- Scratch 3.0 藝術(shù)進(jìn)階
- 從0到1:JavaScript 快速上手
- “互聯(lián)網(wǎng)+”時(shí)代立體化計(jì)算機(jī)組
- 數(shù)據(jù)庫(kù)設(shè)計(jì)與應(yīng)用(SQL Server 2014)(第二版)
- INSTANT Apple iBooks How-to
- 數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)開(kāi)發(fā)實(shí)例
- 從實(shí)踐中學(xué)習(xí)sqlmap數(shù)據(jù)庫(kù)注入測(cè)試
- Gideros Mobile Game Development
- 云計(jì)算寶典:技術(shù)與實(shí)踐