From 601f43e3bb33715794f1e197922b11bff129e51e Mon Sep 17 00:00:00 2001 From: Andrea Aresu Date: Sun, 4 Jul 2021 21:57:26 +0200 Subject: [PATCH] Updated to Swift 5 --- .swift-version | 2 +- Guardian.xcodeproj/project.pbxproj | 18 +++++++++--------- Guardian/Authentication/Authentication.swift | 2 +- .../Generators/OneTimePasswordGenerator.swift | 4 ++-- GuardianApp/AppDelegate.swift | 2 +- GuardianTests/Keys/SigningKeyStorageSpec.swift | 2 +- README.md | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.swift-version b/.swift-version index 7d5c902..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1 +5.0 diff --git a/Guardian.xcodeproj/project.pbxproj b/Guardian.xcodeproj/project.pbxproj index 33c49cf..dc61c63 100644 --- a/Guardian.xcodeproj/project.pbxproj +++ b/Guardian.xcodeproj/project.pbxproj @@ -651,19 +651,19 @@ TargetAttributes = { 5F2037CC1D5E1E3E0005D2E2 = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0940; + LastSwiftMigration = 1250; ProvisioningStyle = Manual; }; 5F2037D61D5E1E3E0005D2E2 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 86WQXF56BC; - LastSwiftMigration = 0940; + LastSwiftMigration = 1250; TestTargetID = 5F2037EA1D5E22590005D2E2; }; 5F2037EA1D5E22590005D2E2 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 86WQXF56BC; - LastSwiftMigration = 0940; + LastSwiftMigration = 1250; ProvisioningStyle = Manual; SystemCapabilities = { com.apple.Push = { @@ -994,7 +994,7 @@ SKIP_INSTALL = YES; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1020,7 +1020,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_INSTALL_OBJC_HEADER = NO; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1039,7 +1039,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.auth0.GuardianTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GuardianApp.app/GuardianApp"; }; name = Debug; @@ -1058,7 +1058,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.auth0.GuardianTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GuardianApp.app/GuardianApp"; }; name = Release; @@ -1088,7 +1088,7 @@ PROVISIONING_PROFILE_SPECIFIER = "match Development com.auth0.guardian.sample"; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -1117,7 +1117,7 @@ PROVISIONING_PROFILE = "32df3887-3767-4b67-84a6-144aaf2ef2f2"; PROVISIONING_PROFILE_SPECIFIER = "match Development com.auth0.guardian.sample"; SWIFT_INSTALL_OBJC_HEADER = NO; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; diff --git a/Guardian/Authentication/Authentication.swift b/Guardian/Authentication/Authentication.swift index 4c9f647..da81c29 100644 --- a/Guardian/Authentication/Authentication.swift +++ b/Guardian/Authentication/Authentication.swift @@ -113,7 +113,7 @@ public protocol Authentication { } public extension Authentication { - public func reject(notification: Notification, withReason reason: String? = nil) -> Request { + func reject(notification: Notification, withReason reason: String? = nil) -> Request { return self.reject(notification: notification, withReason: reason) } } diff --git a/Guardian/Generators/OneTimePasswordGenerator.swift b/Guardian/Generators/OneTimePasswordGenerator.swift index 7d844e6..226c0ff 100644 --- a/Guardian/Generators/OneTimePasswordGenerator.swift +++ b/Guardian/Generators/OneTimePasswordGenerator.swift @@ -28,11 +28,11 @@ public protocol TOTP { } public extension TOTP { - public func stringCode(time: TimeInterval = Date().timeIntervalSince1970, formatter: NumberFormatter? = nil) -> String { + func stringCode(time: TimeInterval = Date().timeIntervalSince1970, formatter: NumberFormatter? = nil) -> String { return self.stringCode(time: time, formatter: formatter) } - public func code() -> Int { + func code() -> Int { return self.code(time: Date().timeIntervalSince1970) } } diff --git a/GuardianApp/AppDelegate.swift b/GuardianApp/AppDelegate.swift index 26f391d..b0d00da 100644 --- a/GuardianApp/AppDelegate.swift +++ b/GuardianApp/AppDelegate.swift @@ -31,7 +31,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { static var pushToken: String? = nil var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let guardianCategory = Guardian.AuthenticationCategory.default diff --git a/GuardianTests/Keys/SigningKeyStorageSpec.swift b/GuardianTests/Keys/SigningKeyStorageSpec.swift index 1d7e8c1..0776d57 100644 --- a/GuardianTests/Keys/SigningKeyStorageSpec.swift +++ b/GuardianTests/Keys/SigningKeyStorageSpec.swift @@ -78,7 +78,7 @@ class KeychainBot { func clean(by tag: String? = nil) { if let tag = tag { remove(with: tag) - guard let index = self.tags.index(of: tag) else { return } + guard let index = self.tags.firstIndex(of: tag) else { return } self.tags.remove(at: index) } else { self.tags.forEach { self.remove(with: $0) } diff --git a/README.md b/README.md index a6ff25f..25cd89d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![License](https://img.shields.io/cocoapods/l/Guardian.svg?style=flat-square)](http://cocoadocs.org/docsets/Guardian) [![Platform](https://img.shields.io/cocoapods/p/Guardian.svg?style=flat-square)](http://cocoadocs.org/docsets/Guardian) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage) -![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat-square) +![Swift 5](https://img.shields.io/badge/Swift-5-orange.svg?style=flat-square) [Guardian](https://auth0.com/docs/multifactor-authentication/guardian) is Auth0's multi-factor authentication (MFA) service that provides a simple, safe way for you to implement MFA. @@ -20,7 +20,7 @@ multi-factor authentication from your app. ## Requirements -iOS 10+ and Swift 4.1 is required in order to use Guardian. +iOS 10+ and Swift 5 is required in order to use Guardian. ## Before getting started