Serhii Didanov
Serhii Didanov

Reputation: 2348

PromiseKit in Linux swift project works not as expected

If you execute in Linux swift project something like:

import PromiseKit

func runAsyncAction() {
    firstly {
        executeSomePromiseFunc()
    }.done {
        getResult($0)
    }
}

getResult($0) will never be executed. Why?

Upvotes: 1

Views: 42

Answers (1)

Serhii Didanov
Serhii Didanov

Reputation: 2348

In Linux swift project you need to use:

import PromiseKit
import Dispatch

func runAsyncAction() {
    firstly {
        executeSomePromiseFunc()
    }.done(on:DispatchQueue.global()) {
        getResult($0)
    }.ensure(on:DispatchQueue.global()) {

    }.catch(on:DispatchQueue.global()) {

    }
}

PS. Works on Ubuntu 16.04, Swift 4.2

Upvotes: 1

Related Questions