Book Image

Swift 2 Design Patterns

By : Julien Lange
Book Image

Swift 2 Design Patterns

By: Julien Lange

Overview of this book

Table of Contents (15 chapters)
Swift 2 Design Patterns
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, you learned how to deal with structures of multiple objects. The composite pattern allows you to access and alter data structures in a uniform way, whereas the flyweight pattern is a more accurate way to save the memory space or time spent in calculation when they are multiple similar objects.

A flyweight pattern is useful with other patterns to keep data as small as possible. The composite pattern is useful in combination with other patterns to manage the data structure. The composite pattern can use a flyweight pattern, but the inverse will not.

In this chapter, I tried to present you with something different; using the XCTest framework, to test the performance of our pattern. If you want to dive deeper, you can try to see the difference in the memory allocation using the instrument tools provided in Xcode.

In the next chapter, we will continue with the discovery of our structural patterns by learning what the adapter and facade patterns are.