Skip to content

Commit 869b2c1

Browse files
author
Anton Soloviev
committed
Fix error in mediator pattern.
1 parent 7768083 commit 869b2c1

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

Design-Patterns.playground.zip

49 Bytes
Binary file not shown.

Design-Patterns.playground/Pages/Behavioral.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class MessageMediator: Mediator {
318318
func send(message: String, colleague: Colleague) {
319319
for c in colleagues {
320320
if c !== colleague { //for simplicity we compare object references
321-
colleague.receive(message)
321+
c.receive(message)
322322
}
323323
}
324324
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class MessageMediator: Mediator {
363363
func send(message: String, colleague: Colleague) {
364364
for c in colleagues {
365365
if c !== colleague { //for simplicity we compare object references
366-
colleague.receive(message)
366+
c.receive(message)
367367
}
368368
}
369369
}

source/behavioral/mediator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class MessageMediator: Mediator {
3939
func send(message: String, colleague: Colleague) {
4040
for c in colleagues {
4141
if c !== colleague { //for simplicity we compare object references
42-
colleague.receive(message)
42+
c.receive(message)
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)