soledue / EasyThread

Thread wrapper for easy use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EasyThread

Swift 4.x Under MIT License Platform

Requirements

  • iOS
  • Xcode

Serial queue

let q = EasyThread.getQueue(processors: 1)
    q.dispatch {
        print("uno")
    }
    q.dispatch {
        print("due")
    }
    q.dispatch {
        print("tre")
    }
}

Concurrent queue

let q = EasyThread.getQueue(processors: 10)
    q.dispatch {
        print("uno")
    }
    q.dispatch {
        print("due")
    }
    q.dispatch {
        print("tre")
    }
}

Promises

    try? Promise<Int>{
        return 10
    }.next { r -> String in
        let v = try 
        return "test"
    }.next { r -> Int in
        let v = try r()
        return 1
    }.fail { error in
        print(error)
    }.wait()

Author

i.kanev@reply.it

License

Short is available under the MIT license. See the LICENSE file for more info.

About

Thread wrapper for easy use


Languages

Language:Swift 100.0%