I have a four buttons and one table view in one viewController. I want to select the entries in my table with the button. E.g. I have a list of persons and one button says "family" one "friends" one "collegues" and one "unknown" by clicking on one button the table only should show the persongroup I selected. The entries of the table view are stored in an global array. Changing the array with clicking is possible (I see this in the command line), but the table does not change. Does any one know why ? For storing and selecting data I use core data. In the IBAction I do this:
Code Block @IBAction func friendTapped(_ sender: Any) { guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else{ return } let context = appDelegate.persistentContainer.viewContext let entityName = "Person" let request = NSFetchRequest<NSFetchRequestResult>(entityName: entityName) let pred = NSPredicate(format: "relationship_status CONTAINS 'friend'") request.predicate = pred do { let results = try context.fetch(request) for r in results{ if let result = r as? NSManagedObject{ guard let relationship_status = result.value(forKey: "relationship_status") as? String else { return } guard let name = result.value(forKey: "name") as? String else { return } self.table_entries.append(name) print("load") } } print ("done") print (table_entries) } catch { print(error) }