Skip to content

Commit

Permalink
Merge pull request #28 from smart-on-fhir/develop
Browse files Browse the repository at this point in the history
Update to FHIR R4 and Swift 4.2
  • Loading branch information
xmlmodeling authored Mar 7, 2019
2 parents e251904 + fe4dcb3 commit acfa161
Show file tree
Hide file tree
Showing 20 changed files with 1,561 additions and 1,304 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

## 4.0

- Update to FHIR **R4** (`4.0.0-a53ec6ee1b`)
- Update to Swift 4.2


## 3.2.0

Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Contributing
============

For fixes, improvements and ideas, fork the repository and issue a pull request.
To get a pull request accepted, please adhere to these two rules:

- Work from the latest `develop` branch, unless it's a very small fix
- Respect current code style (indent with tabs, compare to existing code for more clues)

Ideally, only work on one feature at a time.
If you've done work on the code (i.e. not just fixes to the README), add yourself to the top of [`CONTRIBUTORS.md`](./CONTRIBUTORS.md).

Happy coding!
8 changes: 8 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Contributors
============

Contributors to the codebase, in reverse chronological order:

- Dave Carlson, @drdavec
- Pascal Pfiffner, @p2

4 changes: 2 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>4.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.2.0.0</string>
<string>4.0.0.0</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion OAuth2
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><img src="./assets/banner.png" alt=""></p>

Swift-SMART is a full client implementation of the 🔥FHIR specification for building apps that interact with healthcare data through [**SMART on FHIR**][smart].
Written in _Swift 3_ it is compatible with **iOS 8** and **OS X 10.10** and newer and requires Xcode 8 or newer.
Written in _Swift 4.2_ it is compatible with **iOS 11** and **macOS 10.13** and newer and requires Xcode 10 or newer.


### Versioning
Expand All @@ -15,6 +15,7 @@ See [tags/releases](https://github.com/smart-on-fhir/Swift-SMART/releases).

Version | Swift | FHIR | &nbsp;
---------|-----------|---------------|-----------------------------
**4.0** | 4.2 | `4.0.0-a53ec6ee1b` | R4
**3.2** | 3.2 | `3.0.0.11832` | STU 3
**3.0** | 3.0 | `3.0.0.11832` | STU 3
**2.9** | 3.0 | `1.6.0.9663` | STU 3 Ballot, Sep 2016
Expand Down
6 changes: 3 additions & 3 deletions SMART.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Pod::Spec.new do |s|
s.name = "SMART"
s.version = "3.2.0"
s.version = "4.0.0"
s.summary = "Swift SMART on FHIR framework for iOS and OS X"
s.description = <<-DESC
Swift SMART on FHIR framework for iOS and OS X.
Expand All @@ -26,8 +26,8 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/smart-on-fhir/Swift-SMART.git", :tag => "#{s.version}", :submodules => true }
s.prepare_command = "git submodule update --init --recursive" # The :submodules flag above is not recursive :P

s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.ios.deployment_target = "11.0"
s.osx.deployment_target = "10.13"

s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DNO_MODEL_IMPORT -DNO_MODULE_IMPORT -DNO_KEYCHAIN_IMPORT' }
s.source_files = "Sources/Client/*.swift",
Expand Down
6 changes: 4 additions & 2 deletions Sources/Client/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Auth {
// SMART OAuth2 endpoints are at rest[0].security.extension[#].valueUri
if let smartauth = security.extensions(forURI: "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris")?.first?.extension_fhir {
for subext in smartauth where nil != subext.url {
switch subext.url?.absoluteString ?? "" {
switch subext.url?.string ?? "" {
case "authorize":
authSettings["authorize_uri"] = subext.valueUri?.absoluteString
case "token":
Expand Down Expand Up @@ -245,7 +245,9 @@ class Auth {
internal func authDidSucceed(withParameters parameters: OAuth2JSON) {
if let props = authProperties, props.granularity == .patientSelectNative {
server.logger?.debug("SMART", msg: "Showing native patient selector after authorizing with parameters \(parameters)")
showPatientList(withParameters: parameters)
callOnMainThread() {
showPatientList(withParameters: parameters)
}
}
else {
server.logger?.debug("SMART", msg: "Did authorize with parameters \(parameters)")
Expand Down
2 changes: 1 addition & 1 deletion Sources/Client/PatientList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ open class PatientList {
open var order = PatientListOrder.nameFamilyASC

/// The query used to create the list.
open let query: PatientListQuery
public let query: PatientListQuery

/// Indicating whether not all patients have yet been loaded.
open var hasMore: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Client/PatientListQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A query that returns a list of patients.
open class PatientListQuery {

/// The FHIR search element that produces the desired patient list
open let search: FHIRSearch
public let search: FHIRSearch

var isDone = false

Expand Down
5 changes: 5 additions & 0 deletions Sources/Client/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ open class Server: FHIROpenServer, OAuth2RequestPerformer {
}
}

/// Authenticated identity and profile token of end user; Assigned when scopes `openid` and `profile` are used.
public var idToken: String? {
get { return auth?.oauth?.idToken }
}

var mustAbortAuthorization = false

/// An optional NSURLSessionDelegate.
Expand Down
18 changes: 10 additions & 8 deletions Sources/iOS/PatientList+iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ open class PatientListViewController: UITableViewController {
}

/// Block to execute when a patient has been selected.
var onPatientSelect: ((Patient?) -> Void)?
public var onPatientSelect: ((Patient?) -> Void)?

var didSelectPatientFlag = false

Expand All @@ -37,7 +37,7 @@ open class PatientListViewController: UITableViewController {
}
}

lazy var activity = UIActivityIndicatorView(activityIndicatorStyle: .gray)
lazy var activity = UIActivityIndicatorView(style: .gray)

weak var headerLabel: UILabel?

Expand Down Expand Up @@ -74,7 +74,9 @@ open class PatientListViewController: UITableViewController {
patientList?.onStatusUpdate = { [weak self] error in
if let this = self {
if let error = error {
UIAlertView(title: NSLocalizedString("Loading Patients Failed", comment: ""), message: error.description, delegate: nil, cancelButtonTitle: "OK").show()
let alertController = UIAlertController(title: NSLocalizedString("Loading Patients Failed", comment: ""), message: error.description, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .cancel))
this.present(alertController, animated: true, completion: nil)
}
if nil != this.patientList && .loading == this.patientList!.status {
this.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: this.activity)
Expand Down Expand Up @@ -113,6 +115,7 @@ open class PatientListViewController: UITableViewController {
}
}

@objc
open func dismissFromModal(_ sender: AnyObject?) {
presentingViewController?.dismiss(animated: nil != sender)
}
Expand Down Expand Up @@ -212,7 +215,7 @@ extension PatientList {
*/
class PatientTableViewCell: UITableViewCell {

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
}

Expand All @@ -225,10 +228,9 @@ class PatientTableViewCell: UITableViewCell {

// birthday and age
if let bdate = patient?.birthDate {
let attr = NSMutableAttributedString(string: "\(bdate.description) (\(patient!.currentAge))", attributes: [NSForegroundColorAttributeName: UIColor.gray])
attr.setAttributes([
NSForegroundColorAttributeName: UIColor.black
], range: NSMakeRange(0, 4))
let attr = NSMutableAttributedString(string: "\(bdate.description) (\(patient!.currentAge))", attributes:
[NSAttributedString.Key.foregroundColor: UIColor.gray])
attr.setAttributes([NSAttributedString.Key.foregroundColor: UIColor.black], range: NSMakeRange(0, 4))
detailTextLabel?.attributedText = attr
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Swift-FHIR
Submodule Swift-FHIR updated 401 files
Loading

0 comments on commit acfa161

Please sign in to comment.