Swift-SMART is a full client implementation of the 🔥FHIR specification for building apps that interact with healthcare data through SMART on FHIR. Written in Swift it is compatible with iOS 8 and OS X 10.9 and newer and requires Xcode 6 or newer.
The master
branch is currently on FHIR DSTU 1 (0.0.82
).
The develop
branch is up-to-date for the FHIR DSTU 2 May 2015 ballot (0.5.0
).
There are tags indicating which data models are baked into the framework. Compare those to the list of published FHIR versions.
- Programming Guide with code examples
- Technical Documentation of classes, properties and methods
- Medication List sample app
- SMART on FHIR API documentation
See the programming guide for more code examples and details.
import SMART
// create the client
let smart = Client(
baseURL: "https://fhir-api-dstu2.smarthealthit.org",
settings: [
"client_id": "my_mobile_app",
"redirect": "smartapp://callback", // must be registered
]
)
// authorize, then search for prescriptions
smart.authorize() { patient, error in
if nil != error || nil == patient {
// report error
}
else {
MedicationPrescription.search(["patient": patient!.id])
.perform(smart.server) { bundle, error in
if nil != error {
// report error
}
else {
var meds = [MedicationPrescription]()
if let entries = bundle?.entry {
for entry in entries {
if let med = entry.resource as? MedicationPrescription {
meds.append(med)
}
}
}
// now `meds` holds all known patient prescriptions
}
}
}
}
This work is Apache 2 licensed.