I have an entity titled Locations, which is initially populated with JSON via Alamofire. On a UIViewController with an embedded TableView and refresh button, I need to search for three specific entries in the Location entity.
Here is what I have so far:
//Refresh button action
@IBAction func refreshAction(_ sender: AnyObject) {
let locationPredicate = NSPredicate(format: "title = %@", "Bronco Stadium", "Morrison Center", "2 Morrison Center")
let fetchRequest:NSFetchRequest<Location> = Location.fetchRequest()
fetchRequest.predicate = locationPredicate
do {
let results = try DatabaseController.getContext().fetch(fetchRequest)
locationList = results as [Location]
tableView.reloadData()
} catch {
print("Error with request: \(error)")
}
}
results is returning with one entry: "Bronco Stadium". My hope is that it would return with the three items passed to the NSPredicate.
I apologize if this is a silly question; I'm new to Swift.