Philip007
Philip007

Reputation: 3230

Why predicate not a property of NSFetchRequest?

NSFetchRequest has methods predicate and setPredicate. I wonder why Apple not make predicate a property of NSFetchRequest? That would make life a little bit easier.

More, it appears that NSFetchRequest has no properties at all.. What's the underlying principle behind this?

Upvotes: 1

Views: 121

Answers (2)

Martin R
Martin R

Reputation: 539745

You can write

fetchRequest.predicate = predicate;

even if predicate is not declared as property of NSFetchRequest. The compiler translates this to

[fetchRequest setPredicate:predicate];

Upvotes: 2

grahamparks
grahamparks

Reputation: 16296

There's one very good reason it has no properties:

  • NSFetchRequest was introduced with Core Data in Mac OS X 10.4.
  • Properties were introduced with Objective-C 2.0 in Mac OS X 10.5.

So the class predates the invention of Objective-C properties, and for whatever reason has never been revisited.

Upvotes: 4

Related Questions