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

Add BFVoid macro to allow enforcing 'void' result types on BFTask. #289

Closed nlutsenko closed 7 years ago

nlutsenko commented 7 years ago

Instead of returning a BFTask with no generic type, or a generic type of 'NSNull' when there is no usable result from a task, we use the type 'BFVoid', which will always have a value of nil.

This allows you to provide a more enforced API contract to the caller, as sending any message to BFVoid will result in a compile time error.

Thank you @richardjrossiii for this hack, it simplifies a lot of boilerplate. Also cc @gotemb as it would allow enforcing a lot of API contracts for you.

seuzxh commented 5 years ago

@nlutsenko I saw your explaining about BFVoid. But I'm not sure about this one :

"sending any message to BFVoid will result in a compile time error."

Do you mean [BFVoid continueWithBlock] or [AnyBFTask<BFVoid> continueWithBlock] ? Thanks for your answer first :)