From da2067b4003070d91096032a7bb629ef40bd6e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 21 Jun 2018 16:59:51 +0200 Subject: [PATCH] Add swift version check for default runloop case name --- Sources/Nimble/Utils/Async.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Nimble/Utils/Async.swift b/Sources/Nimble/Utils/Async.swift index b9898f804..f3c3886d4 100644 --- a/Sources/Nimble/Utils/Async.swift +++ b/Sources/Nimble/Utils/Async.swift @@ -256,7 +256,11 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode + #if swift(>=4.2) + _ = RunLoop.current.run(mode: .default, before: .distantFuture) + #else _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) + #endif } self.trigger.timeoutSource.cancel()