BoltsFramework / Bolts-ObjC

Bolts is a collection of low-level libraries designed to make developing mobile apps easier.
Other
5.64k stars 576 forks source link

Wrap BFTask in object #296

Open bvirlet opened 7 years ago

bvirlet commented 7 years ago

Hello,

I want to create a Bolt task that depends on a lot of injected parameters.

Ideally, I would like to wrap my BFTask in a class in order to pass all the dependencies by injection when instantiating my object.

But doing so is not ideal because the object wouldn't be easily retained.

Eg.

func myFunc() {
   MyBigTask(injectedParams).task().continueOnSuccessWith( … )
}

What is a good strategy to create reusable bolt tasks?