TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: Offline data base with exercise in App

Forums > SwiftUI

@mrgg  

Hi!

I make fitness app and I want give users offline data base with exercises. As I understand when user install app from App Store (app with Core Data) has a empty data base.

I dont want use API, because is expensive (earlier I make this app in React Native and make API so user add this exercises from web).

How I can add exercise to Core Data in elegant way?

My idea is making JSON/CSV file with exercises (its about 1000 exercises). Attatch this file to App bundle and when App running first time i add this exercisers to Core Data.

It is good approach? Can I do this a better way?

2      

You can do that. Depending on the exercises and what data it contains this shouldn't be a problem.

One hint, though. If you add it on start up do this on a background thread. Depending on amount of data your app seems to freeze and can be unresponsive for a few seconds. Your users could think the app doesn't work when the UI is unresponsive.

3      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.