Howdy all,
I am working on a simple Core Data app. I have two classes: Client and Home. There is a one-to-many relationship between Clients and Homes (i.e., a Client can have many Homes. Among other attributes, the Home class has one called purchaseDate.
I am trying to write two methods on the Client class: -homesByDate and -firstHome. -homesByDate should return either an NSArray or NSSet of the client's homes sorted by purchaseDate. -firstHome should return just the first home that the client purchased.
I know that given a Client, I can use self.homes to access all of the client's homes, but how do I implement the methods above? Does this involve applying some sort of an NSPredicate?
Help! Thanks!