- 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.
- 數(shù)據(jù)分析實戰(zhàn):基于EXCEL和SPSS系列工具的實踐
- SQL Server 2008數(shù)據(jù)庫應(yīng)用技術(shù)(第二版)
- 正則表達(dá)式必知必會
- InfluxDB原理與實戰(zhàn)
- Learning Spring Boot
- Enterprise Integration with WSO2 ESB
- 數(shù)據(jù)架構(gòu)與商業(yè)智能
- 數(shù)據(jù)庫設(shè)計與應(yīng)用(SQL Server 2014)(第二版)
- 高維數(shù)據(jù)分析預(yù)處理技術(shù)
- Apache Kylin權(quán)威指南
- Flutter Projects
- INSTANT Apple iBooks How-to
- Hadoop集群與安全
- Hands-On System Programming with C++
- 智能與數(shù)據(jù)重構(gòu)世界