In my application, I’m having NSArray that holds objects of NSDictionary.
In each dictionary, there’s one “Primary” that holds value of type NSNumber which stores “YES” or “NO” (boolean value). And only dictionary object in the array can have the value “YES”.
Without using loops how can I get the dictionary object where the “Primary” key is YES?
In my application, I’m having NSArray that holds objects of NSDictionary. In each dictionary,
Share
You can call a convenience method on
NSArrayto find the object, but be aware, that such a method still uses a loop internally to find the object.Another option would be
-[NSArray filteredArrayUsingPredicate:].