App structure iOS and Realm: create database when app is installed -


i new ios. developing app data persistence. have decided use realm purpose.

i must create database , load data first time app runs. data web service in json format. implement strategy update database later, maybe ios silent push notifications.

i have read , have worked realm, loading data json... learn that.

now, need apply in project don't know how start. need clues general idea app:

how can organize app load data when installed? @ point should create database , load data?

i have thought create global realm object y appdelegate , use global variable. idea?

do need set path database? can user default path?

if looking place start, can check out example apps of ui component add-on realm: abfrealmgridcontroller.

the controller subclass of uicollectionview , example app should demonstrate of functionality curious about. example uses controller display top news stories new york times. involves making request api , loading json response data realm.

when load data dependent on how want app function. if data same each user, bundle realm file app pre-populated data.

the abfrealmgridcontroller example loads data when user clicks refresh button , performs json handling on background thread; general best-practice.

finally, unless have multiple realms or need store file in specific path, simplest use default path.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -