Learn the basics of object-oriented design in Swift. In this second part, you'll learn about polymorphism, initialization, and some common design patterns for dealing with objects.
Code worked well prior to this, but after entering this I get an error on the extension line:
"Use of undeclared type โPrintableโ
Iโve been able to convert everything in the tutorial before this to Swift 3, but this one area is tripping me up. Apologies if Iโve missed something obvious.
Thanks,
John
Thanks for this article. I like how you put it together.
The only issue is that the example for Adapter is rather a Decorator.
An Adapter changes the interface of a type to make it compatible with another interface; whereas a Decorator enhances a type without changing the existing interface.
You even mentioned that protocol extensions are a good fit to implement the Decorator pattern.
Now, it would be nice to also update the code, since Printable is not available anymore in Swift 3.0. Replace it with CustomStringConvertible as others also suggested.