Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// MARK: - Originator Protocol
//
extension AppleStore: Originator
{
/**
Crea un *snaphot* (memento) del stock
de la Apple Store en este momento
*/
public func createMemento() -> Memento
{
let memento = Memento(stockForiPhone: self.iPhoneStock,
iPad: self.iPadStock,
mac: self.macStock,
tv: self.tvStock)
return memento
}
/**
Restaura las existencias de la Apple Store a partir
de un *snapshot* (memento)
*/
public mutating func restore(from memento: Memento) -> Void
{
self.iPhoneStock = memento.iPhoneStock
self.iPadStock = memento.iPadStock
self.macStock = memento.macStock
self.tvStock = memento.tvStock
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.