Swift 2 Design Patterns

Build robust and scalable iOS and Mac OS X game applications

Swift 2 Design Patterns

This ebook is included in a Mapt subscription
Julien Lange

1 customer reviews
Build robust and scalable iOS and Mac OS X game applications
$10.00
$39.99
RRP $31.99
RRP $39.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781785887611
Paperback224 pages

Book Description

Swift is a multi-paradigm language. It has expressive features familiar to those used to work with modern functional languages, while also keeping the object-oriented features of Objective-C. It remains compatible with Apple’s legacy codes and frameworks. A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. Knowledge about design patterns is also one of the best ways to make you different compared to other low-level developers.

This book shows you how to use Swift 2 to learn about 23 Gang of Four (GoF) design patterns, and is organized into three categories. The book will present you the five creational patterns, followed by the seven structural patterns, and finishing with the 11 behavioral patterns as defined by the GoF. Each chapter will introduce the pattern by defining its role, which common problems the pattern should be used for, its generic UML representation, how each objects presented in the class diagram participate in the pattern, and what the role of each of these objects is. The book then presents you with a concrete case as an illustration that will be used to implement the pattern using Swift.

Table of Contents

Chapter 1: Creational Patterns
The prototype pattern
The factory method pattern
The singleton pattern
The abstract factory pattern
The builder pattern
Summary
Chapter 2: Structural Patterns – Decorator, Proxy, and Bridge
Static and dynamic composition
The decorator pattern
The proxy pattern
The bridge pattern
Summary
Chapter 3: Structural Patterns – Composite and Flyweight
The composite pattern
The flyweight pattern
Summary
Chapter 4: Structural Patterns – Adapter and Facade
The adapter pattern
The facade pattern
Summary
Chapter 5: Behavioral Patterns – Strategy, State, and Template Method
The strategy pattern
The state pattern
The template method
Summary
Chapter 6: Behavioral Patterns – Chain of Responsibility and Command
The chain of responsibility pattern
The command pattern
Comparison between the chain of responsibility and command patterns
Summary
Chapter 7: Behavioral Patterns – Iterator, Mediator, and Observer
The iterator pattern
The mediator pattern
The observer pattern
Summary
Chapter 8: Behavioral Patterns – Visitor, Interpreter, and Memento
The visitor pattern
The interpreter pattern
The memento pattern
Comparing the three patterns
Summary

What You Will Learn

  • Choose the appropriate pattern depending on the problem to be solved
  • Understand the generic class diagram of each of the 23 GoF patterns and how each object participates in the pattern
  • Use Swift to implement these patterns even though the language doesn’t provide all of the object-oriented programming concepts such as abstract class, interface, and so on
  • Architect your software to avoid the overuse of memory, time spent on calculations, or high network traffic
  • Find the best way to organize your code to make it more secure from the outside world
  • Prepare your code to make it more flexible when the consumer changes or the third-party component hidden code changes
  • Structure your code to change the algorithm to apply at runtime
  • Deliver Flyweight responsibility to your objects

Authors

Table of Contents

Chapter 1: Creational Patterns
The prototype pattern
The factory method pattern
The singleton pattern
The abstract factory pattern
The builder pattern
Summary
Chapter 2: Structural Patterns – Decorator, Proxy, and Bridge
Static and dynamic composition
The decorator pattern
The proxy pattern
The bridge pattern
Summary
Chapter 3: Structural Patterns – Composite and Flyweight
The composite pattern
The flyweight pattern
Summary
Chapter 4: Structural Patterns – Adapter and Facade
The adapter pattern
The facade pattern
Summary
Chapter 5: Behavioral Patterns – Strategy, State, and Template Method
The strategy pattern
The state pattern
The template method
Summary
Chapter 6: Behavioral Patterns – Chain of Responsibility and Command
The chain of responsibility pattern
The command pattern
Comparison between the chain of responsibility and command patterns
Summary
Chapter 7: Behavioral Patterns – Iterator, Mediator, and Observer
The iterator pattern
The mediator pattern
The observer pattern
Summary
Chapter 8: Behavioral Patterns – Visitor, Interpreter, and Memento
The visitor pattern
The interpreter pattern
The memento pattern
Comparing the three patterns
Summary

Book Details

ISBN 139781785887611
Paperback224 pages
Read More
From 1 reviews

Read More Reviews