O'Reilly logo

Swift 2 Design Patterns by Julien Lange

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

The memento pattern

The memento pattern will be the last pattern that we will discover together. You will see that this pattern is really interesting to work with and has many uses.

Roles

The role of the memento pattern is to capture an object's internal state and save it externally so that it can be restored later without breaking the encapsulation of this object.

Design

The generic UML class diagram is defined as the following:

Design

Participants

The following are the participants of the memento pattern:

  • Memento: This is the class for the objects that saved the internal states of origin objects (or part of this state), such as the introduction of the fact ...

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