Group Group Group Group Group Group Group Group Group

The free preview chapters are awesome

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

2 Likes

Thanks amitsrivastava! :wave: It’s always interesting to know what code is the most helpful. I have found for myself all it takes is that one example and suddenly a ton of stuff makes sense. This, of course, is a stepping stone to the next chapter (also free) where you start using protocols as generic type constraints. Cool and exciting stuff.