//
// NSRunLoop+Utils.swift
//
// This source file is part of the Telegram Bot SDK for Swift (unofficial).
//
// Copyright (c) 2015 - 2016 Andrey Fidrya and the project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See LICENSE.txt for license information
// See AUTHORS.txt for the list of the project authors
//

import Foundation
import Dispatch

public extension RunLoop {
	public func waitForSemaphore(_ sem: DispatchSemaphore) {
		repeat {
            run(mode: .default, before: Date(timeIntervalSinceNow: 0.01))
		} while .success != sem.wait(timeout: DispatchTime.now())
	}
}

//
// NSRunLoop+Utils.swift
//
// This source file is part of the Telegram Bot SDK for Swift (unofficial).
//
// Copyright (c) 2015 - 2016 Andrey Fidrya and the project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See LICENSE.txt for license information
// See AUTHORS.txt for the list of the project authors
//

import Foundation
import Dispatch

public extension RunLoop {
	public func waitForSemaphore(_ sem: DispatchSemaphore) {
		repeat {
            run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 0.01))
		} while .success != sem.wait(timeout: DispatchTime.now())
	}
}

--- 
+++ 
@@ -16,7 +16,7 @@
 public extension RunLoop {
 	public func waitForSemaphore(_ sem: DispatchSemaphore) {
 		repeat {
-            run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 0.01))
+            run(mode: .default, before: Date(timeIntervalSinceNow: 0.01))
 		} while .success != sem.wait(timeout: DispatchTime.now())
 	}
 }
Remove unnecessary code of Xcode automatic conversion
