Skip to content

Commit 88f9f93

Browse files
authored
Implement SPM support (#646)
1 parent e5c28dc commit 88f9f93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+126
-10
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ examples/**/Pods/
3131
# Carthage
3232
Carthage/
3333

34+
# SPM
35+
.swiftpm
36+
.build
37+
Package.resolved
38+
3439
#Fabric
3540
.fabric_key
3641

App/ViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class ViewController: UIViewController {
105105
.withOptions {
106106
applyDefaultOptions(&$0)
107107
$0.allow = [.Login]
108-
$0.usernameStyle = [.Email]
108+
$0.usernameStyle = [.Username]
109109
}
110110
.withConnections { connections in
111111
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
@@ -116,6 +116,7 @@ class ViewController: UIViewController {
116116
.classic()
117117
.withOptions {
118118
applyDefaultOptions(&$0)
119+
$0.usernameStyle = [.Username]
119120
}
120121
.withConnections { connections in
121122
connections.social(name: "apple", style: .Apple)

Lock/AuthPresenter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
class AuthPresenter: Presentable, Loggable {
2627

Lock/CustomTextField.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
public struct CustomTextField {
2627

Lock/EnterpriseDomainPresenter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
class EnterpriseDomainPresenter: Presentable, Loggable {
2627

Lock/Extensions.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
extension Optional {
2627

Lock/Layout.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
// MARK: - NSLayoutXAxisAnchor
2627
@discardableResult func constraintEqual<C: NSLayoutAnchor<NSLayoutXAxisAnchor>>(anchor: C, toAnchor anotherAnchor: C, constant: CGFloat? = nil, priority: UILayoutPriority = UILayoutPriority.priorityRequired) -> NSLayoutConstraint {

Lock/LazyImage.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
/**
2627
* Convenience struct to hold an image reference to a `NSBundle` without loading the `UIImage`.

Lock/Lock.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425
import Auth0
2526

2627
/// Lock main class to configure and show the native widget

Lock/MessageView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
2324
import UIKit
2425

2526
class MessageView: UIView {

Lock/Navigable.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425
import Auth0
2526

2627
protocol Navigable {

Lock/ObserverStore.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425
import Auth0
2526

2627
struct ObserverStore: Dispatcher {

Lock/OnePassword.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
protocol PasswordManager {
2627

Lock/PasswordlessPresenter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
class PasswordlessPresenter: Presentable, Loggable {
2627

Lock/Resources.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

25-
public func bundleForLock() -> Bundle { return Bundle(for: InputField.classForCoder()) }
26+
public func bundleForLock() -> Bundle {
27+
#if SWIFT_PACKAGE
28+
return Bundle.module
29+
#else
30+
return Bundle(for: InputField.classForCoder())
31+
#endif
32+
}
2633

2734
func lazyImage(named name: String) -> LazyImage { return LazyImage(name: name, bundle: bundleForLock()) }
2835

Lock/Router.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425
import Auth0
2526

2627
protocol Router: Navigable {

Lock/Style.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
/**
2627
* Define Auth0 Lock style and allows to customise it.

Lock/UnrecoverableErrorPresenter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import Foundation
24+
import UIKit
2425

2526
class UnrecoverableErrorPresenter: Presentable {
2627
let navigator: Navigable

LockTests/AuthCollectionViewSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

LockTests/CountryTableViewControllerSpec.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

@@ -55,11 +56,10 @@ class CountryTableViewControllerSpec: QuickSpec {
5556

5657
it("should return cell info for Argentina") {
5758
let index = IndexPath(item: 8, section: 0)
58-
expect(tableView.cellForRow(at: index)?.textLabel?.text) == "Argentina"
59-
expect(tableView.cellForRow(at: index)?.detailTextLabel?.text) == "+54"
59+
expect(controller.tableView(tableView, cellForRowAt: index).textLabel?.text) == "Argentina"
60+
expect(controller.tableView(tableView, cellForRowAt: index).detailTextLabel?.text) == "+54"
6061
}
6162

62-
6363
describe("tableview action") {
6464

6565
var countryCode: CountryCode?

LockTests/EmailValidatorSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
2324
import Quick
2425
import Nimble
2526

LockTests/InputFieldSpec.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
26+
2527
@testable import Lock
2628

2729
class InputFieldSpec: QuickSpec {

LockTests/Interactors/Auth0OAuth2InteractorSpec.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222

2323
import Quick
2424
import Nimble
25+
import Auth0
2526
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2630

27-
import Auth0
2831
@testable import Lock
2932

3033
private let DomainURL = URL(fileURLWithPath: domain)

LockTests/Interactors/CDNLoaderInteractorSpec.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import Quick
2424
import Nimble
2525
import OHHTTPStubs
26+
#if SWIFT_PACKAGE
27+
import OHHTTPStubsSwift
28+
#endif
2629

2730
@testable import Lock
2831

LockTests/Interactors/DatabaseInteractorSpec.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
import Quick
2424
import Nimble
25-
import OHHTTPStubs
2625
import Auth0
26+
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2730

2831
@testable import Lock
2932

LockTests/Interactors/DatabasePasswordInteractorSpec.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
import Quick
2424
import Nimble
25-
import OHHTTPStubs
2625
import Auth0
26+
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2730

2831
@testable import Lock
2932

LockTests/Interactors/EnterpriseActiveAuthInteractorSpec.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
import Quick
2424
import Nimble
25-
import OHHTTPStubs
2625
import Auth0
26+
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2730

2831
@testable import Lock
2932

LockTests/Interactors/MultifactorInteractorSpec.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import Quick
2424
import Nimble
2525
import OHHTTPStubs
26+
#if SWIFT_PACKAGE
27+
import OHHTTPStubsSwift
28+
#endif
2629

2730
import Auth0
2831
@testable import Lock

LockTests/Interactors/PasswordlessInteractorSpec.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
import Quick
2424
import Nimble
25-
import OHHTTPStubs
2625
import Auth0
26+
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2730

2831
@testable import Lock
2932

LockTests/LazyImageSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
2324
import Quick
2425
import Nimble
2526

LockTests/LockSpec.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
24+
import UIKit
2325
import Quick
2426
import Nimble
2527
import Auth0
28+
2629
@testable import Lock
2730

2831
class LockSpec: QuickSpec {

LockTests/LockViewControllerSpec.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
24+
import UIKit
2325
import Quick
2426
import Nimble
2527

LockTests/LoggerSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
2324
import Quick
2425
import Nimble
2526

LockTests/Models/AuthStyleSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

LockTests/PasswordlessActivitySpec.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import Quick
2424
import Nimble
2525
import Auth0
2626
import OHHTTPStubs
27+
#if SWIFT_PACKAGE
28+
import OHHTTPStubsSwift
29+
#endif
2730

2831
@testable import Lock
2932

LockTests/Presenters/AuthPresenterSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

LockTests/Presenters/BannerMessagePresenterSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

LockTests/Presenters/DatabaseForgotPasswordPresenterSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import Foundation
2324
import Quick
2425
import Nimble
2526

LockTests/Presenters/DatabasePresenterSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Quick
2425
import Nimble
2526

LockTests/Router/ClassicRouterSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
import UIKit
2324
import Nimble
2425
import Quick
2526
import Auth0

0 commit comments

Comments
 (0)