Skip to content

Commit

Permalink
Merge pull request ochococo#27 from markthethomas/patch-1
Browse files Browse the repository at this point in the history
Fix spelling errors -- memeto --> memento
  • Loading branch information
ochococo committed Nov 12, 2014
2 parents b19094a + 2a7982d commit 4b08484
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ class GameState {
var gameLevel: Int = 1
var playerScore: Int = 0

func saveToMemeto() -> Memento {
func saveToMemento() -> Memento {
return ["gameLevel": gameLevel, "playerScore": playerScore]
}

func restoreFromMemeto(memento: Memento) {
func restoreFromMemento(memento: Memento) {
gameLevel = memento["gameLevel"]! as Int
playerScore = memento["playerScore"]! as Int
}
Expand Down Expand Up @@ -258,27 +258,27 @@ gameState.gameLevel = 2
gameState.playerScore = 200

// Saves state: {gameLevel 2 playerScore 200}
CheckPoint.saveState(gameState.saveToMemeto())
CheckPoint.saveState(gameState.saveToMemento())

gameState.gameLevel = 3
gameState.gameLevel = 250

// Restores state: {gameLevel 2 playerScore 200}
gameState.restoreFromMemeto(CheckPoint.restorePreviousState())
gameState.restoreFromMemento(CheckPoint.restorePreviousState())

gameState.gameLevel = 4

// Saves state - gameState2: {gameLevel 4 playerScore 200}
CheckPoint.saveState(gameState.saveToMemeto(), keyName: "gameState2")
CheckPoint.saveState(gameState.saveToMemento(), keyName: "gameState2")

gameState.gameLevel = 5
gameState.playerScore = 300

// Saves state - gameState3: {gameLevel 5 playerScore 300}
CheckPoint.saveState(gameState.saveToMemeto(), keyName: "gameState3")
CheckPoint.saveState(gameState.saveToMemento(), keyName: "gameState3")

// Restores state - gameState2: {gameLevel 4 playerScore 200}
gameState.restoreFromMemeto(CheckPoint.restorePreviousState(keyName: "gameState2"))
gameState.restoreFromMemento(CheckPoint.restorePreviousState(keyName: "gameState2"))
```
##πŸ‘“ Observer

Expand Down Expand Up @@ -1066,4 +1066,4 @@ Info

πŸ“– Descriptions from: [Gang of Four Design Patterns Reference Sheet](http://www.blackwasp.co.uk/GangOfFour.aspx)

πŸš€ How to generate playground (+zip) from this README: [GENERATE.markdown](https://github.com/ochococo/Design-Patterns-In-Swift/blob/master/GENERATE.markdown)
πŸš€ How to generate playground (+zip) from this README: [GENERATE.markdown](https://github.com/ochococo/Design-Patterns-In-Swift/blob/master/GENERATE.markdown)

0 comments on commit 4b08484

Please sign in to comment.