11_Objective-C Fast Enumeration

So in order to know about fast enumeration, we need know about collection first which will be explained in the following section

Collections in Objective-C

  • Collections are fundamental constructs.
  • It is used to hold and manage other objects.
  • The whole purpose of a collection is that it provides a common way to store and retrieve objects efficiently.

There are several different types of collections.

While they all fulfil the same purpose of being able to hold other objects, they differ mostly in the way objects are retrieved.

  • NSSet
  • NSArray
  • NSDictionary
  • NSMutableSet
  • NSMutableArray
  • NSMutableDictionary

Fast enumeration Syntax

for (classType variable in collectionObject )


Fast Enumeration Backwards

for (classType variable in [collectionObject reverseObjectEnumerator] )


Comments are closed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: