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

Add code example for block based callbacks #66

Merged
merged 2 commits into from
Jan 30, 2016
Merged

Conversation

8W9aG
Copy link
Contributor

@8W9aG 8W9aG commented Jan 30, 2016

  • Shows the reader how to get block based callbacks
    for the SPTDataLoader delegates

* Shows the reader how to get block based callbacks
for the SPTDataLoader delegates
@8W9aG
Copy link
Contributor Author

8W9aG commented Jan 30, 2016

@rastersize @jgavris @dflems

@jgavris
Copy link
Contributor

jgavris commented Jan 30, 2016

👍 But I'm pretty 👎 on this API. Kind of making a mockery of block API's.

@8W9aG
Copy link
Contributor Author

8W9aG commented Jan 30, 2016

@jgavris can you explain?

@jgavris
Copy link
Contributor

jgavris commented Jan 30, 2016

If I wanted to use a block based API, I would prefer to just do performRequest:completionBlock:. You're telling me I have to implement a delegate protocol and actually call the block myself?

@8W9aG
Copy link
Contributor Author

8W9aG commented Jan 30, 2016

Yeh, the aim is definitely to discourage the use of blocks when it comes to long network calls (for the reasons in the README)

@jgavris
Copy link
Contributor

jgavris commented Jan 30, 2016

If you want to discourage use because it's relatively easier to make mistakes by capturing references, why add this example though?

@8W9aG
Copy link
Contributor Author

8W9aG commented Jan 30, 2016

Because the README makes a reference to the fact that sometimes block based callbacks are very useful depending on the circumstance (however it also states that those circumstances are rare). Having said that, if we are to acknowledge that this can be a good pattern when done correctly we should provide an example on how this can be done. I do believe that there should be some friction to using this pattern due to its drawbacks.

8W9aG added a commit that referenced this pull request Jan 30, 2016
Add code example for block based callbacks
@8W9aG 8W9aG merged commit bae6ea6 into spotify:master Jan 30, 2016
@8W9aG 8W9aG deleted the block-README branch January 30, 2016 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants