Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Add Swift Package Manager configuration (smart-on-fhir#30)
Browse files Browse the repository at this point in the history
* Add Swift Package Manager config

* Update Package config OAuth2 release

* Update Package config OAuth2 release
  • Loading branch information
drdavec authored and xmlmodeling committed Sep 16, 2019
1 parent 90fe545 commit f5d2830
Show file tree
Hide file tree
Showing 21 changed files with 222 additions and 1,791 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ build
# Docs
docs

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
Package.pins
Package.resolved

.build/
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.0
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

## 4.2

- Add support for Swift Package Manager; deprecate CocoaPod support.


## 4.1

- Update to Swift 5.0
Expand Down
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>4.1.0</string>
<string>4.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4.1.0.0</string>
<string>4.2.0.0</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
1 change: 0 additions & 1 deletion OAuth2
Submodule OAuth2 deleted from 7466c2
32 changes: 32 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version:5.0
// Package.swift
//
// Created by Dave Carlson on 8/8/19.

import PackageDescription

let package = Package(
name: "SMART",
platforms: [
.macOS(.v10_13), .iOS(.v11)
],
products: [
.library(
name: "SMART",
targets: ["SMART"]),
],
dependencies: [
.package(url: "https://github.com/smart-on-fhir/Swift-FHIR", "4.2.0"..<"5.0.0"),
.package(url: "https://github.com/p2/OAuth2", "5.1.0"..<"6.0.0"),
],
targets: [
.target(
name: "SMART",
dependencies: [
.product(name: "OAuth2"),
.product(name: "FHIR"),
],
path: "Sources",
sources: ["SMART", "Client", "iOS", "macOS"]),
]
)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See [tags/releases](https://github.com/smart-on-fhir/Swift-SMART/releases).

Version | Swift | FHIR | &nbsp;
---------|-----------|---------------|-----------------------------
**4.2** | 5.0 Package | `4.0.0-a53ec6ee1b` | R4
**4.1** | 5.0 | `4.0.0-a53ec6ee1b` | R4
**4.0** | 4.2 | `4.0.0-a53ec6ee1b` | R4
**3.2** | 3.2 | `3.0.0.11832` | STU 3
Expand Down
57 changes: 0 additions & 57 deletions SMART.podspec

This file was deleted.

4 changes: 2 additions & 2 deletions Sources/Client/PatientListQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ open class PatientListQuery {
isDone = false
}

func execute(onServer server: FHIRServer, order: PatientListOrder, callback: @escaping (Bundle?, FHIRError?) -> Void) {
func execute(onServer server: FHIRServer, order: PatientListOrder, callback: @escaping (SMART.Bundle?, FHIRError?) -> Void) {
if isDone {
callback(nil, nil)
return
}

let cb: (Bundle?, FHIRError?) -> Void = { bundle, error in
let cb: (SMART.Bundle?, FHIRError?) -> Void = { bundle, error in
if nil != error || nil == bundle {
callback(nil, error)
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/Client/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ open class Server: FHIROpenServer, OAuth2RequestPerformer {
get { return auth?.oauth?.idToken }
}

/// The refresh token provided with the access token; Issuing a refresh token is optional at the discretion of the authorization server.
public var refreshToken: String? {
get { return auth?.oauth?.refreshToken }
}

var mustAbortAuthorization = false

/// An optional NSURLSessionDelegate.
Expand Down Expand Up @@ -135,7 +140,7 @@ open class Server: FHIROpenServer, OAuth2RequestPerformer {

open override func perform(request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionTask? {
logger?.debug("SMART", msg: "---> \(request.httpMethod ?? "???") \(request.url?.description ?? "No URL")")
logger?.trace("SMART", msg: "REQUEST\n\(request.debugDescription)\n---")
logger?.trace("SMART", msg: "REQUEST\n\(String(describing: request))\n---")
return super.perform(request: request) { data, response, error in
self.logger?.trace("SMART", msg: "RESPONSE\n\(response.debugDescription)\n---")
self.logger?.debug("SMART", msg: "<--- \((response as? HTTPURLResponse)?.statusCode ?? 999) (\(data?.count ?? 0) Byte)")
Expand Down
12 changes: 12 additions & 0 deletions Sources/SMART/SMART.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// SMART.swift
//
// Created by Dave Carlson on 8/8/19.
//

/**
Export dependencies so that projects using the SMART package do not need to also import dependency modules.
*/
@_exported import OAuth2
@_exported import FHIR

3 changes: 3 additions & 0 deletions Sources/iOS/Auth+iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2014 SMART Health IT. All rights reserved.
//

#if os(iOS)
import UIKit


Expand Down Expand Up @@ -73,3 +74,5 @@ extension Auth {
}
}

#endif

3 changes: 3 additions & 0 deletions Sources/iOS/PatientList+iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2015 SMART Health IT. All rights reserved.
//

#if os(iOS)
import UIKit


Expand Down Expand Up @@ -251,3 +252,5 @@ class PatientTableViewCell: UITableViewCell {
}
}

#endif

3 changes: 3 additions & 0 deletions Sources/macOS/Auth+macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2014 SMART Health IT. All rights reserved.
//

#if os(macOS)
import Cocoa


Expand All @@ -31,3 +32,5 @@ extension Auth {
}
}

#endif

1 change: 0 additions & 1 deletion Swift-FHIR
Submodule Swift-FHIR deleted from 3628b1
Loading

0 comments on commit f5d2830

Please sign in to comment.