Skip to content

Commit b8a9cba

Browse files
codethought2ochococo
authored andcommitted
cleanups of compile errors and subtle\n changes to the call structure so progammers see what the \n template pattern implemenation looks like at runtime
1 parent 10c2196 commit b8a9cba

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

‎Design-Patterns.playground.zip

155 Bytes
Binary file not shown.

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ protocol Garden {
636636
extension Garden {
637637

638638
func prepareGarden() {
639-
func prepareSoil()
640-
func plantSeeds()
641-
func waterPlants()
639+
prepareSoil()
640+
plantSeeds()
641+
waterPlants()
642642
}
643643
}
644644

@@ -649,15 +649,15 @@ final class RoseGarden: Garden {
649649
}
650650

651651
func prepareSoil() {
652-
// Implementation
652+
print ("prepare soil for rose garden")
653653
}
654654

655655
func plantSeeds() {
656-
// Implementation
656+
print ("plant seeds for rose garden")
657657
}
658658

659659
func waterPlants() {
660-
// Implementation
660+
print ("water the rose garden")
661661
}
662662
}
663663

‎README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,9 @@ protocol Garden {
706706
extension Garden {
707707

708708
func prepareGarden() {
709-
func prepareSoil()
710-
func plantSeeds()
711-
func waterPlants()
709+
prepareSoil()
710+
plantSeeds()
711+
waterPlants()
712712
}
713713
}
714714

@@ -719,15 +719,15 @@ final class RoseGarden: Garden {
719719
}
720720

721721
func prepareSoil() {
722-
// Implementation
722+
print ("prepare soil for rose garden")
723723
}
724724

725725
func plantSeeds() {
726-
// Implementation
726+
print ("plant seeds for rose garden")
727727
}
728728

729729
func waterPlants() {
730-
// Implementation
730+
print ("water the rose garden")
731731
}
732732
}
733733

‎source/behavioral/template_method.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ protocol Garden {
1616
extension Garden {
1717

1818
func prepareGarden() {
19-
func prepareSoil()
20-
func plantSeeds()
21-
func waterPlants()
19+
prepareSoil()
20+
plantSeeds()
21+
waterPlants()
2222
}
2323
}
2424

@@ -29,15 +29,15 @@ final class RoseGarden: Garden {
2929
}
3030

3131
func prepareSoil() {
32-
// Implementation
32+
print ("prepare soil for rose garden")
3333
}
3434

3535
func plantSeeds() {
36-
// Implementation
36+
print ("plant seeds for rose garden")
3737
}
3838

3939
func waterPlants() {
40-
// Implementation
40+
print ("water the rose garden")
4141
}
4242
}
4343

0 commit comments

Comments
 (0)