1

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:

  • id
  • name
  • address
  • age

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

1 Answer 1

1

You can find in Apple's documentation for propertiesToFetch:

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.