4

Just wondering, it seems like it works pretty well but I want to make sure I am using generally accepted coding practices and not get into bad habits.

Thanks,

Nick

nickthedude
  • 4,925
  • 10
  • 36
  • 51

2 Answers2

9

Yes, it's good form. It was introduced as the preferred style of enumeration in Objective-C 2.0, in fact. Use it wherever possible.

John Calsbeek
  • 35,947
  • 7
  • 94
  • 101
  • 3
    It should also be noted that fast enumeration executes faster than using NSEnumerator, and way faster than a `for` loop. – Tom Dalling Jan 10 '10 at 06:44
0

Fast enumeration is a recent addition to the language, so don't be concerned that you're not seeing it much in other people's code. It takes a while for people to adopt new habits.

NSResponder
  • 16,861
  • 7
  • 32
  • 46