diff --git a/CHANGES.rst b/CHANGES.rst index cfa2d2659..57dc9ae60 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,7 +3,7 @@ Changes in 0.8.2 (2019-xx-xx) Improvements: * Upgrade MatrixKit version ([v0.9.6](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.9.6). - * Maintenance: Update cocopoads and pods. + * Maintenance: Update cocopoads and pods. Automatic update to Swift4.2 Bug fix: * Reskin: status bar text is no more readable on iPad (#2276). diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index 6ed5783ba..6b4418e00 100644 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -3013,6 +3013,7 @@ 24CBEC4D1F0EAD310093EABB = { CreatedOnToolsVersion = 8.3.2; DevelopmentTeam = 7J4U792NQT; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { @@ -3033,7 +3034,7 @@ F094A9A11B78D8F000B1FBBF = { CreatedOnToolsVersion = 6.2; DevelopmentTeam = 7J4U792NQT; - LastSwiftMigration = 0940; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { @@ -3805,7 +3806,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/RiotShareExtension-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -3839,7 +3840,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/RiotShareExtension-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -4035,7 +4036,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/Riot-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -4075,7 +4076,7 @@ PRODUCT_BUNDLE_IDENTIFIER = im.vector.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/Riot-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Riot/Categories/UIControl.swift b/Riot/Categories/UIControl.swift index a6323581a..0706d4c96 100644 --- a/Riot/Categories/UIControl.swift +++ b/Riot/Categories/UIControl.swift @@ -31,7 +31,7 @@ class ClosureSleeve { } extension UIControl { - func vc_addAction(for controlEvents: UIControlEvents = .primaryActionTriggered, action: @escaping () -> ()) { + func vc_addAction(for controlEvents: UIControl.Event = .primaryActionTriggered, action: @escaping () -> ()) { let sleeve = ClosureSleeve(attachTo: self, closure: action) addTarget(sleeve, action: #selector(ClosureSleeve.invoke), for: controlEvents) } diff --git a/Riot/Categories/UIViewController.swift b/Riot/Categories/UIViewController.swift index 2b0e16155..e3aee9ad3 100644 --- a/Riot/Categories/UIViewController.swift +++ b/Riot/Categories/UIViewController.swift @@ -39,11 +39,11 @@ extension UIViewController { /// - viewController: The child view controller to add. /// - view: The view on which to add the child view controller view. func vc_addChildViewController(viewController: UIViewController, onView view: UIView) { - self.addChildViewController(viewController) + self.addChild(viewController) viewController.view.frame = view.bounds view.vc_addSubViewMatchingParent(viewController.view) - viewController.didMove(toParentViewController: self) + viewController.didMove(toParent: self) } @@ -51,9 +51,9 @@ extension UIViewController { /// /// - Parameter viewController: The child view controller to remove. func vc_removeChildViewController(viewController: UIViewController) { - viewController.willMove(toParentViewController: nil) + viewController.willMove(toParent: nil) viewController.view.removeFromSuperview() - viewController.removeFromParentViewController() + viewController.removeFromParent() } diff --git a/Riot/Generated/Images.swift b/Riot/Generated/Images.swift index 78ad0f5a7..486035dc0 100644 --- a/Riot/Generated/Images.swift +++ b/Riot/Generated/Images.swift @@ -1,5 +1,5 @@ // swiftlint:disable all -// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen #if os(OSX) import AppKit.NSImage diff --git a/Riot/Generated/RiotDefaults.swift b/Riot/Generated/RiotDefaults.swift index 66279954e..5c063181b 100644 --- a/Riot/Generated/RiotDefaults.swift +++ b/Riot/Generated/RiotDefaults.swift @@ -1,4 +1,5 @@ -// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen +// swiftlint:disable all +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen import Foundation @@ -30,8 +31,6 @@ internal enum RiotDefaults { internal static let presenceColorForUnavailableUser: Int = _document["presenceColorForUnavailableUser"] internal static let pushGatewayURL: String = _document["pushGatewayURL"] internal static let pushKitAppIdProd: String = _document["pushKitAppIdProd"] - internal static let pusherAppIdDev: String = _document["pusherAppIdDev"] - internal static let pusherAppIdProd: String = _document["pusherAppIdProd"] internal static let roomDirectoryServers: [String: Any] = _document["roomDirectoryServers"] internal static let showAllEventsInRoomHistory: Bool = _document["showAllEventsInRoomHistory"] internal static let showLeftMembersInRoomMemberList: Bool = _document["showLeftMembersInRoomMemberList"] diff --git a/Riot/Generated/Storyboards.swift b/Riot/Generated/Storyboards.swift index 7b3025f9f..afafd57f1 100644 --- a/Riot/Generated/Storyboards.swift +++ b/Riot/Generated/Storyboards.swift @@ -1,5 +1,5 @@ // swiftlint:disable all -// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen // swiftlint:disable sorted_imports import Foundation diff --git a/Riot/Managers/Theme/Theme.swift b/Riot/Managers/Theme/Theme.swift index 50970fed0..241c9924c 100644 --- a/Riot/Managers/Theme/Theme.swift +++ b/Riot/Managers/Theme/Theme.swift @@ -58,7 +58,7 @@ import UIKit /// Status bar style to use var statusBarStyle: UIStatusBarStyle { get } - var scrollBarStyle: UIScrollViewIndicatorStyle { get } + var scrollBarStyle: UIScrollView.IndicatorStyle { get } var keyboardAppearance : UIKeyboardAppearance { get } diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index 8e50e1b7b..4d08afb07 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -53,7 +53,7 @@ class DarkTheme: NSObject, Theme { UIColor(rgb: 0xAC3BA8)] var statusBarStyle: UIStatusBarStyle = .lightContent - var scrollBarStyle: UIScrollViewIndicatorStyle = .white + var scrollBarStyle: UIScrollView.IndicatorStyle = .white var keyboardAppearance: UIKeyboardAppearance = .dark var placeholderTextColor: UIColor = UIColor(white: 1.0, alpha: 0.3) @@ -70,7 +70,7 @@ class DarkTheme: NSObject, Theme { func applyStyle(onNavigationBar navigationBar: UINavigationBar) { navigationBar.tintColor = self.baseTextPrimaryColor; navigationBar.titleTextAttributes = [ - NSAttributedStringKey.foregroundColor: self.baseTextPrimaryColor + NSAttributedString.Key.foregroundColor: self.baseTextPrimaryColor ] navigationBar.barTintColor = self.baseColor; diff --git a/Riot/Managers/Theme/Themes/DefaultTheme.swift b/Riot/Managers/Theme/Themes/DefaultTheme.swift index fb43f1fec..7690e6685 100644 --- a/Riot/Managers/Theme/Themes/DefaultTheme.swift +++ b/Riot/Managers/Theme/Themes/DefaultTheme.swift @@ -53,7 +53,7 @@ class DefaultTheme: NSObject, Theme { UIColor(rgb: 0xAC3BA8)] var statusBarStyle: UIStatusBarStyle = .lightContent - var scrollBarStyle: UIScrollViewIndicatorStyle = .default + var scrollBarStyle: UIScrollView.IndicatorStyle = .default var keyboardAppearance: UIKeyboardAppearance = .light var placeholderTextColor: UIColor = UIColor(white: 0.7, alpha: 1.0) // Use default 70% gray color @@ -70,7 +70,7 @@ class DefaultTheme: NSObject, Theme { func applyStyle(onNavigationBar navigationBar: UINavigationBar) { navigationBar.tintColor = self.baseTextPrimaryColor; navigationBar.titleTextAttributes = [ - NSAttributedStringKey.foregroundColor: self.baseTextPrimaryColor + NSAttributedString.Key.foregroundColor: self.baseTextPrimaryColor ] navigationBar.barTintColor = self.baseColor; diff --git a/Riot/Modules/Common/KeyboardAvoiding/KeyboardAvoider.swift b/Riot/Modules/Common/KeyboardAvoiding/KeyboardAvoider.swift index aa23f7efc..3413dabd6 100644 --- a/Riot/Modules/Common/KeyboardAvoiding/KeyboardAvoider.swift +++ b/Riot/Modules/Common/KeyboardAvoiding/KeyboardAvoider.swift @@ -23,7 +23,7 @@ final class KeyboardAvoider { private enum KeyboardAnimation { static let defaultDuration: TimeInterval = 0.25 - static let defaultAnimationCurveRawValue: Int = UIViewAnimationCurve.easeInOut.rawValue + static let defaultAnimationCurveRawValue: Int = UIView.AnimationCurve.easeInOut.rawValue } // MARK: - Properties @@ -61,18 +61,18 @@ final class KeyboardAvoider { notificationCenter.addObserver( self, selector: #selector(keyboardWillShow(notification:)), - name: .UIKeyboardWillShow, + name: UIResponder.keyboardWillShowNotification, object: nil) notificationCenter.addObserver( self, selector: #selector(keyboardWillHide(notification:)), - name: .UIKeyboardWillHide, + name: UIResponder.keyboardWillHideNotification, object: nil) } private func unregisterKeyboardNotifications() { - NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillShow, object: nil) - NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillHide, object: nil) + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) } @objc private func keyboardWillShow(notification: Notification) { diff --git a/Riot/Modules/Common/KeyboardAvoiding/KeyboardNotification.swift b/Riot/Modules/Common/KeyboardAvoiding/KeyboardNotification.swift index c07af2cc4..cebf3eddd 100644 --- a/Riot/Modules/Common/KeyboardAvoiding/KeyboardNotification.swift +++ b/Riot/Modules/Common/KeyboardAvoiding/KeyboardNotification.swift @@ -29,21 +29,21 @@ public struct KeyboardNotification { } public var keyboardFrameBegin: CGRect? { - guard let value = userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue else { + guard let value = userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue else { return nil } return value.cgRectValue } public var keyboardFrameEnd: CGRect? { - guard let value = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue else { + guard let value = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return nil } return value.cgRectValue } public var animationDuration: TimeInterval? { - guard let number = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber else { + guard let number = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber else { return nil } return number.doubleValue @@ -51,15 +51,15 @@ public struct KeyboardNotification { /// Keyboard UIViewAnimationCurve enum raw value public var animationCurveRawValue: Int? { - guard let number = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber else { + guard let number = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber else { return nil } return number.intValue } /// Convert UIViewAnimationCurve raw value to UIViewAnimationOptions - public func animationOptions(fallbackAnimationCurveValue: Int = UIViewAnimationCurve.easeInOut.rawValue) -> UIViewAnimationOptions { + public func animationOptions(fallbackAnimationCurveValue: Int = UIView.AnimationCurve.easeInOut.rawValue) -> UIView.AnimationOptions { let animationCurveRawValue = self.animationCurveRawValue ?? fallbackAnimationCurveValue - return UIViewAnimationOptions(rawValue: UInt(animationCurveRawValue << 16)) + return UIView.AnimationOptions(rawValue: UInt(animationCurveRawValue << 16)) } }