From f838b1ed32fef30f8e721ca1485c22fe4f3ec3ea Mon Sep 17 00:00:00 2001 From: Antoine van der Lee Date: Thu, 22 Nov 2018 15:46:31 +0100 Subject: [PATCH 1/6] Updated to Swift 4.2 --- Sources/UINotificationCenter.swift | 2 +- Sources/UINotificationDismissTrigger.swift | 2 +- Sources/UINotificationPresentationContext.swift | 6 +++--- .../UINotificationEaseInOutPresenter.swift | 4 ++-- Sources/UINotificationView.swift | 2 +- UINotifications.xcodeproj/project.pbxproj | 12 ++++++------ .../Extensions/XCTestExtensions.swift | 2 +- .../UINotificationDefaultViewTests.swift | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Sources/UINotificationCenter.swift b/Sources/UINotificationCenter.swift index 92bc17b..b1606f9 100644 --- a/Sources/UINotificationCenter.swift +++ b/Sources/UINotificationCenter.swift @@ -23,7 +23,7 @@ public final class UINotificationCenter { /// The window level that notification should appear at. The default level is over the status bar. /// Changing the window level while a notification is displayed might give some issues. - public var windowLevel: UIWindowLevel = UIWindowLevelStatusBar + public var windowLevel: UIWindow.Level = UIWindow.Level.statusBar /// If `true`, the same notifications can be queued. This can result in duplicate notifications being presented after each other. public var isDuplicateQueueingAllowed: Bool = false diff --git a/Sources/UINotificationDismissTrigger.swift b/Sources/UINotificationDismissTrigger.swift index 2f45e67..ebe5e94 100644 --- a/Sources/UINotificationDismissTrigger.swift +++ b/Sources/UINotificationDismissTrigger.swift @@ -17,7 +17,7 @@ public protocol Dismissable: class { /// A trigger which can be used to dismiss an `UINotificationView`. public protocol UINotificationDismissTrigger: class { /// The target to dismiss. - weak var target: Dismissable? { get set } + var target: Dismissable? { get set } } /// A trigger which is schedulable and therefor cancelable. diff --git a/Sources/UINotificationPresentationContext.swift b/Sources/UINotificationPresentationContext.swift index 6cba01f..da04810 100644 --- a/Sources/UINotificationPresentationContext.swift +++ b/Sources/UINotificationPresentationContext.swift @@ -15,7 +15,7 @@ public final class UINotificationPresentationContext { public let containerWindow: UIWindow /// The level the container window should be on when presenting the notification - private let windowLevel: UIWindowLevel + private let windowLevel: UIWindow.Level /// The `UINotificationView` containing the visual representation of the `UINotification`. public let notificationView: UINotificationView @@ -28,7 +28,7 @@ public final class UINotificationPresentationContext { return request.notification } - internal init(request: UINotificationRequest, containerWindow: UIWindow, windowLevel: UIWindowLevel, notificationView: UINotificationView) { + internal init(request: UINotificationRequest, containerWindow: UIWindow, windowLevel: UIWindow.Level, notificationView: UINotificationView) { self.request = request self.containerWindow = containerWindow self.notificationView = notificationView @@ -86,7 +86,7 @@ public final class UINotificationPresentationContext { private func resetContainerWindow() { /// Move the window behind the key application window. - containerWindow.windowLevel = UIWindowLevelNormal - 1 + containerWindow.windowLevel = UIWindow.Level.normal - 1 containerWindow.rootViewController = nil /// Make sure the key window of the app is visible again. diff --git a/Sources/UINotificationPresenters/UINotificationEaseInOutPresenter.swift b/Sources/UINotificationPresenters/UINotificationEaseInOutPresenter.swift index b406ada..de95817 100644 --- a/Sources/UINotificationPresenters/UINotificationEaseInOutPresenter.swift +++ b/Sources/UINotificationPresenters/UINotificationEaseInOutPresenter.swift @@ -35,7 +35,7 @@ public final class UINotificationEaseOutEaseInPresenter: UINotificationPresenter presentationContext.notificationView.topConstraint?.constant = presentationContext.notificationView.layoutMargins.top + UIApplication.shared.statusBarFrame.size.height } - UIView.animate(withDuration: inDuration, delay: 0.0, options: UIViewAnimationOptions.curveEaseOut, animations: { + UIView.animate(withDuration: inDuration, delay: 0.0, options: UIView.AnimationOptions.curveEaseOut, animations: { self.presentationContext.containerWindow.layoutIfNeeded() }, completion: { (_) in self.state = .presented @@ -53,7 +53,7 @@ public final class UINotificationEaseOutEaseInPresenter: UINotificationPresenter presentationContext.notificationView.topConstraint?.constant = -presentationContext.notification.style.height.value - UIView.animate(withDuration: outDuration, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { + UIView.animate(withDuration: outDuration, delay: 0, options: UIView.AnimationOptions.curveEaseIn, animations: { self.presentationContext.containerWindow.layoutIfNeeded() }, completion: { (_) in self.state = .idle diff --git a/Sources/UINotificationView.swift b/Sources/UINotificationView.swift index 268a40a..8e7ce35 100644 --- a/Sources/UINotificationView.swift +++ b/Sources/UINotificationView.swift @@ -165,7 +165,7 @@ open class UINotificationView: UIView { handlePanGestureState(panGestureRecognizer.state, translation: translation) } - internal func handlePanGestureState(_ state: UIGestureRecognizerState, translation: CGPoint) { + internal func handlePanGestureState(_ state: UIGestureRecognizer.State, translation: CGPoint) { guard let presenter = presenter, let topConstraint = topConstraint else { return } if state == .began { diff --git a/UINotifications.xcodeproj/project.pbxproj b/UINotifications.xcodeproj/project.pbxproj index aea7f9e..730ed09 100644 --- a/UINotifications.xcodeproj/project.pbxproj +++ b/UINotifications.xcodeproj/project.pbxproj @@ -481,7 +481,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotifications; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -503,7 +503,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotifications; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -520,7 +520,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotificationsTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -536,7 +536,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotificationsTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -618,7 +618,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotifications; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Test; @@ -635,7 +635,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.UINotificationsTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Test; diff --git a/UINotificationsTests/Extensions/XCTestExtensions.swift b/UINotificationsTests/Extensions/XCTestExtensions.swift index e41ec2f..32958ca 100644 --- a/UINotificationsTests/Extensions/XCTestExtensions.swift +++ b/UINotificationsTests/Extensions/XCTestExtensions.swift @@ -22,7 +22,7 @@ extension XCTestCase { let end = Date().addingTimeInterval(timeout) while !condition() && 0 < end.timeIntervalSinceNow { - if RunLoop.current.run(mode: RunLoopMode.defaultRunLoopMode, before: Date(timeIntervalSinceNow: 0.002)) { + if RunLoop.current.run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 0.002)) { Thread.sleep(forTimeInterval: 0.002) } } diff --git a/UINotificationsTests/UINotificationDefaultViewTests.swift b/UINotificationsTests/UINotificationDefaultViewTests.swift index 6cdfab5..55fb665 100644 --- a/UINotificationsTests/UINotificationDefaultViewTests.swift +++ b/UINotificationsTests/UINotificationDefaultViewTests.swift @@ -18,7 +18,7 @@ final class UINotificationViewTests: UINotificationTestCase { expectation.fulfill() })) let notificationView = UINotificationView(notification: notification) - notificationView.presenter = MockPresenter(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindowLevelStatusBar, notificationView: notificationView), dismissTrigger: nil) + notificationView.presenter = MockPresenter(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindow.Level.statusBar, notificationView: notificationView), dismissTrigger: nil) notificationView.presenter?.present() notificationView.handleTapGestureRecognizer() @@ -32,7 +32,7 @@ final class UINotificationViewTests: UINotificationTestCase { actionTriggeredCount += 1 })) let notificationView = UINotificationView(notification: notification) - notificationView.presenter = MockPresenter(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindowLevelStatusBar, notificationView: notificationView), dismissTrigger: nil) + notificationView.presenter = MockPresenter(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindow.Level.statusBar, notificationView: notificationView), dismissTrigger: nil) notificationView.presenter?.present() notificationView.handleTapGestureRecognizer() @@ -44,7 +44,7 @@ final class UINotificationViewTests: UINotificationTestCase { /// When the pan gesture is used, the animations should be handled by the default view. func testPanGesture() { let notificationView = UINotificationView(notification: notification) - let presenter = MockPresenterCapturer(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindowLevelStatusBar, notificationView: notificationView), dismissTrigger: nil) + let presenter = MockPresenterCapturer(presentationContext: UINotificationPresentationContext(request: UINotificationRequest(notification: notification, delegate: MockRequestDelegate(), notificationViewType: UINotificationView.self), containerWindow: UIWindow(), windowLevel: UIWindow.Level.statusBar, notificationView: notificationView), dismissTrigger: nil) notificationView.presenter = presenter notificationView.handlePanGestureState(.began, translation: CGPoint.zero) From a3a878b6ba206ec0ab313f13361db1f9976270df Mon Sep 17 00:00:00 2001 From: Antoine van der Lee Date: Thu, 22 Nov 2018 16:36:51 +0100 Subject: [PATCH 2/6] Fix CI --- .travis.yml | 2 +- Gemfile | 4 ++-- Submodules/WeTransfer-iOS-CI | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 35dd0d8..44a3e94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode9.2 +osx_image: xcode10.1 gemfile: Gemfile bundler_args: "--without documentation --path bundle" # Don't download documentation for gems. cache: diff --git a/Gemfile b/Gemfile index e024b7e..40fec55 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,9 @@ source "https://rubygems.org" # Needed for Fastlane & Danger -gem 'fastlane', '~>2.86.2' +gem 'fastlane' gem 'danger' -gem 'danger-swiftlint', '~>0.13.1' +gem 'danger-swiftlint' gem 'danger-xcov' gem 'danger-xcode_summary' gem 'xcpretty' diff --git a/Submodules/WeTransfer-iOS-CI b/Submodules/WeTransfer-iOS-CI index de7710f..3e21320 160000 --- a/Submodules/WeTransfer-iOS-CI +++ b/Submodules/WeTransfer-iOS-CI @@ -1 +1 @@ -Subproject commit de7710f6f26ea4268fe35d4373ebdb22663dc7eb +Subproject commit 3e213205a929b54f5c94ccbaebb8047cf49e2296 From 75867c46ec3352d186a87ac72787faa30a339b46 Mon Sep 17 00:00:00 2001 From: Antoine van der Lee Date: Thu, 22 Nov 2018 17:14:30 +0100 Subject: [PATCH 3/6] Update project settings --- UINotifications.xcodeproj/project.pbxproj | 8 +++++++- .../xcshareddata/xcschemes/UINotifications.xcscheme | 8 +++----- .../xcshareddata/xcschemes/UINotificationsTests.xcscheme | 4 +--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/UINotifications.xcodeproj/project.pbxproj b/UINotifications.xcodeproj/project.pbxproj index 730ed09..44b432a 100644 --- a/UINotifications.xcodeproj/project.pbxproj +++ b/UINotifications.xcodeproj/project.pbxproj @@ -256,7 +256,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = WeTransfer; TargetAttributes = { 502C139F206E5F230082CE37 = { @@ -365,6 +365,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -372,6 +373,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -425,6 +427,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -432,6 +435,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -555,6 +559,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -562,6 +567,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme index c74c49f..2a0d9d6 100644 --- a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme +++ b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -57,7 +56,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotificationsTests.xcscheme b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotificationsTests.xcscheme index ac854c9..ddba58c 100644 --- a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotificationsTests.xcscheme +++ b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotificationsTests.xcscheme @@ -1,6 +1,6 @@ Date: Fri, 23 Nov 2018 11:06:16 +0100 Subject: [PATCH 4/6] Applied enum styling like Swift 4.2 does --- Sources/UINotification.swift | 40 +++++++++---------- Sources/UINotificationQueue.swift | 2 +- Sources/UINotificationRequest.swift | 6 +-- .../UINotificationSystemStyle.swift | 2 +- .../UINotificationDefaultElementsTests.swift | 4 +- .../UINotificationDefaultViewTests.swift | 4 +- .../UINotificationTestCase.swift | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Sources/UINotification.swift b/Sources/UINotification.swift index 6a61de6..a879bc6 100644 --- a/Sources/UINotification.swift +++ b/Sources/UINotification.swift @@ -23,7 +23,7 @@ public protocol UINotificationStyle { var backgroundColor: UIColor { get } /// The height of the notification which applies on the notification view. - var height: UINotificationHeight { get } + var height: UINotification.Height { get } /// When `true`, the notification is swipeable and tappable. var interactive: Bool { get } @@ -32,24 +32,6 @@ public protocol UINotificationStyle { var chevronImage: UIImage? { get } } -/// Defines the height which will be applied on the notification view. -public enum UINotificationHeight { - case statusBar - case navigationBar - case custom(height: CGFloat) - - internal var value: CGFloat { - switch self { - case .statusBar: - return UIApplication.shared.statusBarFrame.height - case .navigationBar: - return UIApplication.shared.statusBarFrame.height + 44 - case .custom(let height): - return height - } - } -} - /// Handles changes in UINotification protocol UINotificationDelegate: class { // Called when Notification is updated @@ -58,7 +40,25 @@ protocol UINotificationDelegate: class { /// An UINotification which can be showed on top of the `UINavigationBar` and `UIStatusBar` public final class UINotification: Equatable { - + + /// Defines the height which will be applied on the notification view. + public enum Height { + case statusBar + case navigationBar + case custom(height: CGFloat) + + internal var value: CGFloat { + switch self { + case .statusBar: + return UIApplication.shared.statusBarFrame.height + case .navigationBar: + return UIApplication.shared.statusBarFrame.height + 44 + case .custom(let height): + return height + } + } + } + /// The content of the notification. public var content: UINotificationContent diff --git a/Sources/UINotificationQueue.swift b/Sources/UINotificationQueue.swift index d1fd37f..d5befc5 100644 --- a/Sources/UINotificationQueue.swift +++ b/Sources/UINotificationQueue.swift @@ -81,7 +81,7 @@ internal final class UINotificationQueue { } extension UINotificationQueue: UINotificationRequestDelegate { - func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.UINotificationRequestState) { + func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.State) { switch state { case .finished, .cancelled: remove(request) diff --git a/Sources/UINotificationRequest.swift b/Sources/UINotificationRequest.swift index c1d843b..733362f 100644 --- a/Sources/UINotificationRequest.swift +++ b/Sources/UINotificationRequest.swift @@ -15,7 +15,7 @@ protocol UINotificationRequestDelegate: class { /// - Parameters: /// - request: The `UINotificationRequest` of which the state is changed. /// - state: The new state of the passed `UINotificationRequest`. - func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.UINotificationRequestState) + func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.State) } /// Defines the request of a notification presentation. @@ -26,7 +26,7 @@ public final class UINotificationRequest: Equatable { weak var target: UINotificationRequestDelegate? } - public enum UINotificationRequestState { + public enum State { /// Waiting to run case idle @@ -53,7 +53,7 @@ public final class UINotificationRequest: Equatable { private let identifier: UUID /// The current state of the request. - private(set) public var state: UINotificationRequestState = .idle { + private(set) public var state: UINotificationRequest.State = .idle { didSet { delegates.forEach { $0.target?.notificationRequest(self, didChangeStateTo: state) } } diff --git a/Sources/UINotificationStyles/UINotificationSystemStyle.swift b/Sources/UINotificationStyles/UINotificationSystemStyle.swift index 907c66e..f502627 100644 --- a/Sources/UINotificationStyles/UINotificationSystemStyle.swift +++ b/Sources/UINotificationStyles/UINotificationSystemStyle.swift @@ -15,7 +15,7 @@ public struct UINotificationSystemStyle: UINotificationStyle { public var backgroundColor: UIColor = UIColor.white public var titleTextColor: UIColor = UIColor.black public var subtitleTextColor: UIColor = UIColor.darkGray - public var height: UINotificationHeight = .navigationBar + public var height: UINotification.Height = .navigationBar public var interactive: Bool = true public var chevronImage: UIImage? diff --git a/UINotificationsTests/UINotificationDefaultElementsTests.swift b/UINotificationsTests/UINotificationDefaultElementsTests.swift index 4d0b749..345e500 100644 --- a/UINotificationsTests/UINotificationDefaultElementsTests.swift +++ b/UINotificationsTests/UINotificationDefaultElementsTests.swift @@ -17,8 +17,8 @@ final class UINotificationDefaultElementsTests: UINotificationTestCase { var titleTextColor: UIColor = UIColor.black var subtitleTextColor: UIColor = UIColor.black var backgroundColor: UIColor = UIColor.white - var height: UINotificationHeight { - return UINotificationHeight.custom(height: self.customHeight) + var height: UINotification.Height { + return UINotification.Height.custom(height: self.customHeight) } var interactive: Bool = true var chevronImage: UIImage? diff --git a/UINotificationsTests/UINotificationDefaultViewTests.swift b/UINotificationsTests/UINotificationDefaultViewTests.swift index 55fb665..536d22f 100644 --- a/UINotificationsTests/UINotificationDefaultViewTests.swift +++ b/UINotificationsTests/UINotificationDefaultViewTests.swift @@ -83,8 +83,8 @@ private struct LargeChevronStyle: UINotificationStyle { var titleTextColor: UIColor = UIColor.black var subtitleTextColor: UIColor = UIColor.black var backgroundColor: UIColor = UIColor.white - var height: UINotificationHeight { - return UINotificationHeight.navigationBar + var height: UINotification.Height { + return UINotification.Height.navigationBar } var interactive: Bool = true var chevronImage: UIImage? { diff --git a/UINotificationsTests/UINotificationTestCase.swift b/UINotificationsTests/UINotificationTestCase.swift index 45772bd..e0f6af5 100644 --- a/UINotificationsTests/UINotificationTestCase.swift +++ b/UINotificationsTests/UINotificationTestCase.swift @@ -77,7 +77,7 @@ class UINotificationTestCase: XCTestCase { } internal final class MockRequestDelegate: UINotificationRequestDelegate { - func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.UINotificationRequestState) { } + func notificationRequest(_ request: UINotificationRequest, didChangeStateTo state: UINotificationRequest.State) { } } } From 6e1a0742b12427af347df83c9210e359f36439ff Mon Sep 17 00:00:00 2001 From: Antoine van der Lee Date: Fri, 23 Nov 2018 11:25:49 +0100 Subject: [PATCH 5/6] Make use of the new removeAll method --- Sources/UINotificationQueue.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/UINotificationQueue.swift b/Sources/UINotificationQueue.swift index d5befc5..72029bb 100644 --- a/Sources/UINotificationQueue.swift +++ b/Sources/UINotificationQueue.swift @@ -59,8 +59,7 @@ internal final class UINotificationQueue { internal func remove(_ request: UINotificationRequest) { lockQueue.sync { - guard let index = requests.index(where: { $0 == request }) else { return } - requests.remove(at: index) + requests.removeAll(where: { $0 == request }) } updateRunningRequest() } From 0b0fb7739c0a4f571044fe92c1cbed7fd5589827 Mon Sep 17 00:00:00 2001 From: Antoine van der Lee Date: Fri, 23 Nov 2018 11:32:14 +0100 Subject: [PATCH 6/6] Run tests in random order for Xcode 10 --- .../xcshareddata/xcschemes/UINotifications.xcscheme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme index 2a0d9d6..af772d2 100644 --- a/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme +++ b/UINotifications.xcodeproj/xcshareddata/xcschemes/UINotifications.xcscheme @@ -30,7 +30,8 @@ shouldUseLaunchSchemeArgsEnv = "YES"> + skipped = "NO" + testExecutionOrdering = "random">