Swift CoreDataModel Select

0

I would like to know how do I select only a specific table from my CoreData, for example I have 6 fields, and would like to do a select from only information from a single field, could anyone 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)
}

    
asked by anonymous 29.01.2016 / 23:12

1 answer

0

Based on this question but in Objective-C you can do:

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