GRDBDemoiOS
This application runs an universal (iPhone + iPad) application that displays an editable list of persons.
To manually integrate GRDB as a Framework in your iOS application:
-
Drag the GRDB project in your own project.
-
In the Build Phase tab of your target, add
GRDBiOSin the Target Dependencies section. -
In the Embedded Binaries section of the General tab of your target, add GRDB.xcodeproj/Products/GRDB.framework (iOS).
-
Run.
To see usage of GRDB, check the following files:
-
The setupDatabase() function sets up a global dbQueue that is accessible in the whole application. It is called by the AppDelegate when application starts up.
It uses migrations to initialize the database, and custom string comparison in order to let the database perform the localized sorting of persons by name.
-
MasterViewController is responsible for displaying the list of persons in a table view, deleting persons, and present a person edition form.
-
Person is a simple Record subclass.
-
DetailViewController.swift and PersonEditionViewController.swift
Those two view controllers display and edit a Person, in total isolation from the database.