I was just going through the protocol preview chapter , available for all subscribers , the way it has been explained is totally awesome, it was filling exactly the gaps that i always felt in my attempt to understand protocols, this bit of code really helped so much
func incrementCounters(counters: [?]) {
for counter in counters {
counter.increment(by: 1)
}
}
protocol Incrementable {
func increment(by: Int)
}
func incrementCounters(counters: [Incrementable]) {
for counter in counters {
counter.increment(by: 1)
}
}
will definitely consider the buy option soon, thanks for providing the previews chapters, they are in themselves quite amazing resource β¦
Amit