In Swift, - is in fashion. There’s a lot of Swift code out there that’s “-oriented”, some open-source libraries even state it as a feature. I think protocols are heavily overused in Swift, and oftentimes the problem at hand can be solved in a much simpler way. In short: don’t be dogmatic about using (or avoiding) protocols.

Chris Eidhof references the WWDC 15 talk Protocol-Oriented Programming in Swift as an example of a problem solved using protocols, and at the same how we lose flexibility and add complexity.

Protocol oriented programming certainly has it place, yet…

let the problem drive the solution, not the other way around.

Protocol Oriented Programming is Not a Silver Bullet ~ @chriseidhof

Source link


Please enter your comment!
Please enter your name here