Created
April 23, 2019 10:38
-
-
Save fitomad/8398802b8a3b71b75ff9cecfd6bdd1d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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