This is a simple example project which illustrates some of the functionality of FireKit, Restivus, and Realm
FHIRPatients is built using FireKit, Restivus, and Realm. FHIRPatients requires Swift 4+.
It is also recommended to use Carthage for dependency management.
- Clone this here project
- Run
carthage bootstrap --platform iOS --cache-builds - Go get a coffee. Realm never released Swift 4 binaries via Carthage (for
realm-cocoa2.x), so Carthage will build them for you. This may take a while. - Open the project, build it, sell it for millions 💰
This creates a simple app which allows you to
- Query a remote FHIR server for patients by family name,
- Create, edit, and delete local Patients,
- Upsert (intelligently update or insert) remote patients to the local realm,
- POST/PUT a local Patient to a remote FHIR server,
- Get a feel for Restivus, and
- probably witness the occasional crash and/or other bug
Firstly, do not get overhwlemed by all the code in this project! The vast majority of the code in this application is for governing the user interface, and not relevant to the capabilities of FireKit, Restivus, or Realm. The actual code for FireKit, Restivus, and Realm is limited to 4 relatively simple files:
- PatientModel.swift: Defines the ViewModel, consumed by DetailViewController, EditPatientViewController, PatientDetailHeaderView, and PatientSearchController.swift
- HttpPatients.swift: Defines the various REST requests used for communicating with the FHIR Server; specifically:
- upload (POST & PUT) a
Patient - download (GET) a
Patient, and - search (GET) the server for
Patients with a given family name.
- upload (POST & PUT) a
- HttpDefaults.swift: Defines suitable defaults used by all requests defined in HttpPatients.swift by employing Swift protocol extensions.
- PatientSearchController.swift: Defines UISearchController used by PatientListViewController, and makes use of the
PatientModelandFindPatientsRequest
A quick perusal of those files should give you an understanding of some of the functionality of FireKit and Restivus.