Frank C.
Frank C.

Reputation: 8098

Return substring of Core Data attribute using NSFetchRequest

I have a NSString as an attribute of my NSManagedObject: 'YYYY-MM-DD'. I would like to setup a NSFetchRequest that returns just a substring of the attribute.

Is this possible in IOS 7?

Upvotes: 0

Views: 131

Answers (1)

Wain
Wain

Reputation: 119031

No. You can setup your fetch request to return an array of dictionaries where each dictionary will contain only the single key and value pair and then iterate over the array to create your list of substrings.

Alternatively, add another attribute that holds the substring and update and save it each time the main string changes.

Upvotes: 1

Related Questions