Adds version guards for DispatchQueueConfiguration.

This commit is contained in:
Krunoslav Zaher 2017-08-13 16:56:52 +02:00
parent 8647c06267
commit d4ed2de46c
No known key found for this signature in database
GPG Key ID: 74BC718B68EA3842

View File

@ -43,7 +43,11 @@ extension DispatchQueueConfiguration {
let compositeDisposable = CompositeDisposable()
let timer = DispatchSource.makeTimerSource(queue: queue)
timer.schedule(deadline: deadline, leeway: leeway)
#if swift(>=4.0)
timer.schedule(deadline: deadline, leeway: leeway)
#else
timer.scheduleOneshot(deadline: deadline, leeway: leeway)
#endif
// TODO:
// This looks horrible, and yes, it is.
@ -77,8 +81,12 @@ extension DispatchQueueConfiguration {
var timerState = state
let timer = DispatchSource.makeTimerSource(queue: queue)
timer.schedule(deadline: initial, repeating: dispatchInterval(period), leeway: leeway)
#if swift(>=4.0)
timer.schedule(deadline: initial, repeating: dispatchInterval(period), leeway: leeway)
#else
timer.scheduleRepeating(deadline: initial, interval: dispatchInterval(period), leeway: leeway)
#endif
// TODO:
// This looks horrible, and yes, it is.
// It looks like Apple has made a conceputal change here, and I'm unsure why.