mhacks / mhacks-ios

The official MHacks iOS app
https://mhacks.org
22 stars 6 forks source link

APIManager Completion Blocks #11

Closed russellladd closed 8 years ago

russellladd commented 8 years ago

Sometimes when an object requests an update from the APIManager, it wants to know when its request finishes (and if it succeeded). This information should be passed back in the form of a completion block. If multiple objects make the same request while one is being processed, the requests should be coalesced (so redundant network requests are not made), but all of their completion blocks should be called when the single request finishes. The completion block should be optional.

The completion block should not get the object data from the request, changes in which are still distributed via separate notification mechanism.

This mechanism should be used in the app delegate to simplify the way launch options and push notifications are handled.