Skip to content

Commit

Permalink
Fix RxBlocking in Swift 3
Browse files Browse the repository at this point in the history
Remove force cast in favor of rawValue to fix crash at runtime
  • Loading branch information
tomburns committed Jul 2, 2016
1 parent b72a2ce commit 45b8b32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions RxBlocking/RunLoopLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class RunLoopLock {
}

func dispatch(_ action: () -> ()) {
CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode as! CFTypeRef) {

CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode.rawValue) {
if CurrentThreadScheduler.isScheduleRequired {
_ = CurrentThreadScheduler.instance.schedule(()) { _ in
action()
Expand All @@ -57,7 +58,7 @@ class RunLoopLock {
if AtomicIncrement(&calledStop) != 1 {
return
}
CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode as! CFTypeRef) {
CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode.rawValue) {
CFRunLoopStop(self.currentRunLoop)
}
CFRunLoopWakeUp(currentRunLoop)
Expand Down

0 comments on commit 45b8b32

Please sign in to comment.