I am new in CoreData and I am trying to fetch only one column Data. I am trying using below code:
//MARK :- Fetch All Calculation
func fetchUniqueParentAxis(testID : String) -> [String] {
var arrAxis : [String] = []
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "TesCalculation")
fetchRequest.predicate = NSPredicate(format: "testID == %@ ",testID)
fetchRequest.includesPropertyValues = true
fetchRequest.returnsObjectsAsFaults = false
fetchRequest.propertiesToFetch = ["parentAxis"]
do {
calculation = try AppDelegate.getContext().fetch(fetchRequest) as! [TesCalculation]//try AppDelegate.getContext().fetch(fetchRequest) as! [String : AnyObject]
}
catch let error {
//Handle Error
Helper.sharedInstance.Print(error as AnyObject)
}
}.
"parentAxis" is my a column and I want to fetch data of that column only .