Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaining tasks of different types #46

Closed
ir-fuel opened this issue Nov 23, 2016 · 3 comments
Closed

Chaining tasks of different types #46

ir-fuel opened this issue Nov 23, 2016 · 3 comments
Labels

Comments

@ir-fuel
Copy link

ir-fuel commented Nov 23, 2016

I have tried all kinds of combinations, but it seems impossible to me to chain several tasks (in series) where the tasks have different result types and whereby each task upon error needs to stop the execution of all subsequent tasks. It's compile time error galore for me.

I also think the docs are lacking. They don't really show how to chain multiple tasks using the success/error handlers. The paragraph chaining tasks doesn't even show how to acutally chain tasks.

@schartyom
Copy link

Can you provide some examples? This compiles for me:

func test() -> Task<Void> {
    let stringTask = Task("123")
    let intTask = Task(123)
    let voidTask = Task<Void>.emptyTask()    
    return stringTask.continueOnSuccessWithTask { task in
        return intTask.continueOnSuccessWithTask { task in
            return voidTask
        }
    }
}

@ir-fuel
Copy link
Author

ir-fuel commented Dec 21, 2016

Good point. I tried it again and now I have it working. No idea what happened previously

@ir-fuel ir-fuel closed this as completed Dec 21, 2016
@jkmathew
Copy link

jkmathew commented Feb 8, 2018

the emptyTask is internal scope. How can I use it, if I use Bolts as framework(using cocoapods/carthage)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants