DevPrep

All topics › Databases & storage

What is a fetched property?

Middle PRO

Essence

A fetched property is an entity property in a Core Data model whose value is computed by a query (an NSFetchRequest with a predicate) rather than stored as a relationship. It's a "weak", one-directional relationship: the predicate can refer to the current object's attributes via $FETCH_SOURCE and to external variables via $FETCHED_PROPERTY. The result is always an array (NSArray), even if a single object is found.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store