From 4977ca158f19738f0cd420a1e5668712f4e28709 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Sat, 7 Nov 2020 02:03:32 +0300 Subject: [PATCH] Update DispatchQueue scheduler to match iOS 14.2 behavior --- Sources/OpenCombineDispatch/DispatchQueue+Scheduler.swift | 2 +- .../DispatchTests/DispatchQueueSchedulerTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/OpenCombineDispatch/DispatchQueue+Scheduler.swift b/Sources/OpenCombineDispatch/DispatchQueue+Scheduler.swift index 4f7533e6a..358466212 100644 --- a/Sources/OpenCombineDispatch/DispatchQueue+Scheduler.swift +++ b/Sources/OpenCombineDispatch/DispatchQueue+Scheduler.swift @@ -200,7 +200,7 @@ extension DispatchQueue { /// - Parameter exactly: A binary integer representing a time interval. public init?(exactly source: Source) { guard let value = Int(exactly: source) else { return nil } - self = .nanoseconds(value) + self = .seconds(value) } public static func < (lhs: Stride, rhs: Stride) -> Bool { diff --git a/Tests/OpenCombineTests/DispatchTests/DispatchQueueSchedulerTests.swift b/Tests/OpenCombineTests/DispatchTests/DispatchQueueSchedulerTests.swift index a7ee9faf9..1a09ab571 100644 --- a/Tests/OpenCombineTests/DispatchTests/DispatchQueueSchedulerTests.swift +++ b/Tests/OpenCombineTests/DispatchTests/DispatchQueueSchedulerTests.swift @@ -256,7 +256,7 @@ final class DispatchQueueSchedulerTests: XCTestCase { XCTAssertEqual((2 as Stride).magnitude, 2_000_000_000) XCTAssertNil(Stride(exactly: UInt64.max)) - XCTAssertEqual(Stride(exactly: 871 as UInt64)?.magnitude, 871) + XCTAssertEqual(Stride(exactly: 2 as UInt64)?.magnitude, 2_000_000_000) } func testStrideFromTooMuchSecondsCrashes() {