This PR adds support for Swift Package Manager as the default option for integrating the SDK.
Folder structure
By default, SPM expects sources to be under a top level Sources folder. This can be changed in the Package.swift, but I moved them to keep the default structure.
Test location
Ideally, we would keep all the unit tests under the default top level Tests folder, however there are a couple issues with this:
There are several tests that rely on a functional keychain to pass. The keychain requires app entitlements which cannot be included without an app target to attach to. So these tests must be run from an app target's test cases.
SPM requires that all resources be accessed via Bundle.module instead of the Bundle.main and Bundle(for: ...) instances that were already being used. While technically feasible, this required a lot of changes.
Removal of TestAppShim
TestAppShim was an empty target contained in the sources folder. Since the tests have been moved to the example app this target is no longer needed.
Alternative: We can move the test cases to TestAppShim and leave them out of the SwiftSDK sample app.
Dropped Objc Support
Objc interfaces were dropped in this PR and all the corresponding @objc declarations (except for #selector) were removed. Likewise, the Objc SDK sample app was deleted.
Manually importing UIKit + Foundation
The umbrella header defining global imports was removed from UberRides, so import Foundation and import UIKit needed to be manually added to every class that requires it.
Test Plan
Unit tests
All unit tests should pass from inside the sample app target Swift SDK.
Note: I found a bug in some of the tests that will fail if the Uber Rides app is installed on the simulator. I'll fix this in a later PR.
Manual testing
You can run the SwiftSDK sample app under Examples/Swift SDK. The behavior should remain the same.
Description
This PR adds support for Swift Package Manager as the default option for integrating the SDK.
Folder structure
By default, SPM expects sources to be under a top level Sources folder. This can be changed in the Package.swift, but I moved them to keep the default structure.
Test location
Ideally, we would keep all the unit tests under the default top level Tests folder, however there are a couple issues with this:
Bundle.module
instead of theBundle.main
andBundle(for: ...)
instances that were already being used. While technically feasible, this required a lot of changes.Removal of TestAppShim
TestAppShim was an empty target contained in the sources folder. Since the tests have been moved to the example app this target is no longer needed. Alternative: We can move the test cases to TestAppShim and leave them out of the SwiftSDK sample app.
Dropped Objc Support
Objc interfaces were dropped in this PR and all the corresponding
@objc
declarations (except for #selector) were removed. Likewise, the Objc SDK sample app was deleted.Manually importing UIKit + Foundation
The umbrella header defining global imports was removed from UberRides, so
import Foundation
andimport UIKit
needed to be manually added to every class that requires it.Test Plan
Unit tests
All unit tests should pass from inside the sample app target Swift SDK. Note: I found a bug in some of the tests that will fail if the Uber Rides app is installed on the simulator. I'll fix this in a later PR.
Manual testing
You can run the SwiftSDK sample app under
Examples/Swift SDK
. The behavior should remain the same.