Hey, I have just reduced the price for all products. Let's prepare our programming skills for the post-COVID era. Check it out »
Memento

Memento in Swift

Memento is a behavioral design pattern that allows making snapshots of an object’s state and restoring it in future.

The Memento doesn’t compromise the internal structure of the object it works with, as well as data kept inside the snapshots.

Usage of the pattern in Swift

Complexity:

Popularity:

Usage examples: The Memento’s principle can be achieved using the serialization, which is quite common in Swift. While it’s not the only and the most efficient way to make snapshots of an object’s state, it still allows storing state backups while protecting the originator’s structure from other objects.

Memento in Other Languages

Design Patterns: Memento in Java Design Patterns: Memento in C# Design Patterns: Memento in C++ Design Patterns: Memento in PHP Design Patterns: Memento in Python Design Patterns: Memento in Ruby Design Patterns: Memento in TypeScript Design Patterns: Memento in Go