Swift Coredatamodel Select

Asked

Viewed 25 times

0

I would like to know how I do to select only a specific table of my Coredata, for example I have 6 fields, and I would like to select only information from a single field, someone could help me?

My current code:

let request = NSFetchRequest(entityName: "Person")

request.returnsObjectsAsFaults = false

request.predicate = NSPredicate(format: "wordEasy = %@", "wordEasy")

do{
    let results  = try context.executeFetchRequest(request)
    print(results)
}

inserir a descrição da imagem aqui

1 answer

0

Based in that matter but in Objective-C you can do:

//passe o(s) campo(s) que deseja dentro do Array 
request.propertiesToFetch = ["wordEasy", "wordMedium"] 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.