O'Reilly logo

Learning Swift by Andrew J Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Structural patterns

Structural patterns are patterns that describe how objects should relate to each other so that they can work together to achieve a common goal. They help lower our coupling by suggesting an easy and clear way to break down a problem into related parts. They also help us raise our cohesion by giving us a predefined way in which those components will fit together.

This is like a sports team defining specific roles for each person on the field, so that they can play together better as a team.

The composite pattern

The first structural pattern that we are going to look at is called the composite pattern. The concept of this pattern is that you have a single object that can be broken down into a collection of objects just like it. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required