@@ -99,6 +99,8 @@ atm.canWithdraw(100) // Can withdraw - 1x100
9999atm. canWithdraw ( 165 ) // Cannot withdraw because ATM doesn't has bill with value of 5
100100atm. canWithdraw ( 30 ) // Can withdraw - 1x20, 2x10
101101/*:
102+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Chain-Of-Responsibility)
103+ *//*:
102104👫 Command
103105----------
104106
@@ -250,6 +252,8 @@ intContext.assign(c, value: 3)
250252
251253var result = expression? . evaluate ( intContext)
252254/*:
255+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Interpreter)
256+ *//*:
253257🍫 Iterator
254258-----------
255259
@@ -342,6 +346,8 @@ messagesMediator.addColleague(user1)
342346
343347user0. send ( " Hello " ) // user1 receives message
344348/*:
349+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Mediator)
350+ *//*:
345351💾 Memento
346352----------
347353
@@ -373,14 +379,14 @@ class GameState {
373379/*:
374380Caretaker
375381*/
376- class CheckPoint {
377- class func saveState( memento: Memento , keyName: String = DPMementoGameState) {
382+ enum CheckPoint {
383+ static func saveState( memento: Memento , keyName: String = DPMementoGameState) {
378384 let defaults = NSUserDefaults . standardUserDefaults ( )
379385 defaults. setObject ( memento, forKey: keyName)
380386 defaults. synchronize ( )
381387 }
382388
383- class func restorePreviousState( keyName keyName: String = DPMementoGameState) -> Memento {
389+ static func restorePreviousState( keyName keyName: String = DPMementoGameState) -> Memento {
384390 let defaults = NSUserDefaults . standardUserDefaults ( )
385391
386392 return defaults. objectForKey ( keyName) as? Memento ?? Memento ( )
@@ -459,6 +465,8 @@ var testChambers = TestChambers()
459465testChambers. observer = observerInstance
460466testChambers. testChamberNumber++
461467/*:
468+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Observer)
469+ *//*:
462470🐉 State
463471---------
464472
@@ -518,6 +526,8 @@ context.changeStateToAuthorized(userId: "admin")
518526context. changeStateToUnauthorized ( )
519527( context. isAuthorized, context. userId)
520528/*:
529+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-State)
530+ *//*:
521531💡 Strategy
522532-----------
523533
@@ -561,8 +571,9 @@ lower.printString("O tempora, o mores!")
561571
562572var upper = Printer ( strategy: UpperCaseStrategy ( ) )
563573upper. printString ( " O tempora, o mores! " )
564-
565574/*:
575+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Strategy)
576+ *//*:
566577🏃 Visitor
567578----------
568579
@@ -609,3 +620,6 @@ let names = planets.map { (planet: Planet) -> String in
609620}
610621
611622names
623+ /*:
624+ >**Further Examples:** [Design Patterns in Swift](https://github.com/kingreza/Swift-Visitor)
625+ */
0 commit comments