Skip to content

An implementation of examples from "Head First Design Patterns", written in Swift.

License

Notifications You must be signed in to change notification settings

mrlegowatch/HeadFirstDesignPatternsSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Head First Design Patterns in Swift

This repository contains sample code in Swift based on the book, "Head First Design Patterns", by Freeman & Robson, published by O'Reilly.

This code has been developed as part of a Book Club I am running with members of my team.

The original sample code in Java, which the book's examples are based on, can be found here: https://github.com/bethrobson/Head-First-Design-Patterns.

  • Each chapter has its own Swift Playground illustrating the evolution of sample code into one or two design patterns.
  • Each Playground page represents a step in the evolution of a design pattern, or a variation.
  • The final Playground page for each chapter includes Swift source files. The Playground page itself only contains the final "test" code, corresponding (usually) to the main() function in the Java code. The advantage of moving the final implementation to source files is that it forces consideration of access (public, internal, private, or fileprivate), since the playground itself can only access the public parts.
  • Where relevant, comments with "IN SWIFT:" indicate deviations from the Java sample code, in order to conform to Swift requirements or best practices.

Chapters:

  • Strategy Pattern
  • Observer Pattern
  • Decorator Pattern
  • Factory Pattern
  • Singleton Pattern
  • Command Pattern
  • Adapter and Façade
  • Template Method
  • Iterator and Composite
  • State Pattern

Note: we finished our book club before we completed the code for the remaining chapters. We hope you found this code useful.

About

An implementation of examples from "Head First Design Patterns", written in Swift.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages