SALE: Save 50% on all my books and bundles >>

Group core data before view in Table - Swift 5

Forums > Swift

Hi, in core data I have table with fields: data_id as Int - unique data_name as String data_number as Decimal

How can I group data before fetch in TableView, where data_name is not null? "select data_name from database where (data_name = '') IS NOT TRUE group by date_name"

Swift 5 please. <code> override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return } let managedContext = appDelegate.persistentContainer.viewContext let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Database") do { data_nazev = try managedContext.fetch(fetchRequest) } catch let error as NSError { print("Could not fetch. (error), (error.userInfo)") } } </code>

   

Hacking with Swift is sponsored by RevenueCat

SPONSORED Building in-app subscriptions are hard. RevenueCat makes it simple. With their open source SDKs, you can painlessly implement subscriptions for your app in hours, not months.

Explore the docs to learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Snapthread is a casual video editor and slideshow maker that makes discovering, compiling and sharing your favorite memories effortless.

 
Unknown user

Not logged in

Log in