This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension DispatchQueue { | |
| static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } | |
| } | |
| public typealias Cancelable = ()->() | |
| func performInMain(mode: CFRunLoopMode = CFRunLoopMode.commonModes, closure: @escaping ()->()) { | |
| if Thread.isMainThread && mode == .commonModes { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Darwin | |
| class FileLineReader { | |
| init?(path: String, removeNewLineOnEnd: Bool = true) { | |
| file = fopen(path, "r") | |
| self.removeNewLineOnEnd = removeNewLineOnEnd | |
| if file == nil { | |
| return nil | |
| } | |
| } |