Gian
Gian

Reputation: 1213

Core Data - Select specific Column

I'm trying to select only some columns from my database, but still yes it returns me all. I'm doing the following:

        let fetchRequest = NSFetchRequest(entityName: "Father")
        fetchRequest.propertiesToFetch = NSArray(objects: "id", "name")

        let sorterByName = NSSortDescriptor(key: "name", ascending: true)
        fetchRequest.sortDescriptors = NSArray(object: sorterByName)

i have the following columns:

I need select only id and name but returns all columns.

Upvotes: 1

Views: 494

Answers (1)

Cy-4AH
Cy-4AH

Reputation: 4585

You can find in Apple's documentation for propertiesToFetch:

This value is only used if resultType is set to NSDictionaryResultType.

Upvotes: 1

Related Questions