Book Image

Hands-On Design Patterns with Swift

By : Florent Vilmart, Giordano Scalzo, Sergio De Simone
Book Image

Hands-On Design Patterns with Swift

By: Florent Vilmart, Giordano Scalzo, Sergio De Simone

Overview of this book

Swift keeps gaining traction not only amongst Apple developers but also as a server-side language. This book demonstrates how to apply design patterns and best practices in real-life situations, whether that's for new or already existing projects. You’ll begin with a quick refresher on Swift, the compiler, the standard library, and the foundation, followed by the Cocoa design patterns – the ones at the core of many cocoa libraries – to follow up with the creational, structural, and behavioral patterns as defined by the GoF. You'll get acquainted with application architecture, as well as the most popular architectural design patterns, such as MVC and MVVM, and learn to use them in the context of Swift. In addition, you’ll walk through dependency injection and functional reactive programming. Special emphasis will be given to techniques to handle concurrency, including callbacks, futures and promises, and reactive programming. These techniques will help you adopt a test-driven approach to your workflow in order to use Swift Package Manager and integrate the framework into the original code base, along with Unit and UI testing. By the end of the book, you'll be able to build applications that are scalable, faster, and easier to maintain.
Table of Contents (22 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Summary


In this chapter, we have extensively covered many different aspects of writing and maintaining code bases that share Objective-C and Swift code. Now you should be able to use Swift classes in Objective-C and import your Objective-C classes to Swift, as well as write safe Objective-C with the help of nullability annotations. Not only can your Objective-C code, and should, be safer, with the help of nullability annotations, but you will also tailor your method names so they feel natural in Swift. Lastly, lightweight generics should hold no secrets for you.

With all of these powerful tools in mind, we can continue our journey to the next step: creational design patterns.

Now the design pattern journey can begin. We have prepared ourselves for this in the first chapters. Next in line is the study and implementation of creational design patterns. They are design patterns that are aimed at solving issues related to the creation of object instances. If you feel it isn't always desirable to...