Home

Awesome

SMART on FHIR

An iOS sample app using SMART on FHIR via our iOS SMART on FHIR framework.

Installation

  1. Checkout the source code:

    git clone --recursive https://github.com/smart-on-fhir/SoF-Demo.git
    
  2. Open the project file SoF-Demo.xcodeproj in Xcode 8+.

  3. Select an iPhone simulator and press Run.

The master branch is currently on Swift 4.2 and the R4 (4.0.0-a53ec6ee1b) version of FHIR (version 4.0.0 of the SMART framework).
Check the develop branch for bleeding edge updates, if any, and the tags for older releases.

What's Happening?

This app allows you to specify to which FHIR server you want to connect (bookmark icon top right) and will then let you log in. During login you'll be selecting a patient, after which a handful of resource types belonging to this very patient will be downloaded.

There are two places where custom code performs interesting tasks:

App Delegate

Sets up an EndpointProvider instance that defines which FHIR endpoints (servers) will be available in the app. Right now these are hardcoded, starting at line 25 in AppDelegate.swift.

The app delegate also listens to OAuth2 callbacks in application(_:open:options:) since we'll be using an embedded Safari View Controller to perform the OAuth dance.

Master View Controller

This class is totally overblown and performs these things, aside from setting up the UI:

In the end, you'll see a list of FHIR resource types and the number of resources available to this patient. The app will only load the first page of search results, so the number of resources may be capped at 50.

NOTE that not all servers support searching for patients without specifying search parameters, hence the native patient list may be empty.

List and Detail View Controller

These are handed resources to either show them in a list or display their JSON representation in full.