Flatiron Day 16: Collections and NSPredicate

Morning Assessment brought us back to Object Oriented sprinting with a Person Class with properties like height and age and Foundation based methods to implement.  This was a good start to a day that would be all about the Foundation Framework.

Morning Lecture was about Collections in Foundation.  Specifically, NSSet, NSArray, and NSDictionary.  We discussed that if you are asking yourself the question of whether an object is part of a group then your data structure of choice would be the unordered NSSet but if you find yourself needing to iterate over all the elements of a collection in order to perform some action then you should work with an ordered NSArray.  We then covered set theory in order to frame the power of NSSet and NSArray in this regard: providing with complements, unions, intersections, supersets, etc.

We then continued with NSSortDescriptors and some examples before breaking for lunch.

As predicted yesterday today was indeed a Sophie’s day with some Beef Stew.

After lunch we went into Afternoon Lecture where we covered NSPredicate which is a Foundation class that specifies how data should be fetched or filtered. Think of it like the ‘where’ clause of a SQL statement which provides an interface to define logical conditions on which a collection is searched.  From there we went to discuss NSFetchedResultsController which you use to manage the results returned from a Core Data fetch request to provide data for a UITableView object.

We then went into Afternoon Lab where we updated Senari with Tags where every item can be Tagged and a Tag can cover many items (Many to One) and they persist in Core Data.

Homework 4 is also due tonight which is CouchPotato – our version of the Moves App – activity tracking to display calories burned.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s