-
Notifications
You must be signed in to change notification settings - Fork 22
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
Remove strong references for delegates and completion handlers #78
Conversation
If we want to remain consistent with how it's done for Android, I think we should still keep dispatching to main queue. I'm not strongly skilled in iOS, so I'm not sure if it behaves the same way as Android, but basically we did it for Android as a convenience so that the response (either success or failure) will come back on the main UI thread so that in case the client response handler has to execute some code on UI thread (any code updating UI has to), there is no need to manually transition to it. For iOS I'm assuming it's kind of similar, dispatch to main queue = main UI thread. If you remove this, we lose parity with Android. Also I think this would be a breaking change as it will break all response handlers that are performing operations that can only be done on the main thread, and weren't transitioning to it by themselves (because response was done on main thread implicitly, now its not). Ideally we should maybe by default, dispatch the response on the same thread that initiated the request, be it main or separate one. Need to look at how other popular libraries are doing it, what's the common practice there. We might not be doing thing the proper way. EDIT Anyway, I guess I'm OK with the rest of the code changes, but removing dispatch to main queue for responses, could (will) I think break quite some clients calls... This is definitely a breaking change. In any case we should not remove the default to main queue I think, which is kinda the 'standard' and what's expected by the client for such kind of libraries. We should instead offer other options apart from this default operating mode (but much more work involved). |
thanks for detailed response. so just some explanation of how we got here: motivation is to remove strong references to delegate properties. with
@nalex87 would this be safe in your opinion? |
This looks fine to me. can we try it out? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@belemaire Do you know if we need to dispatch calling the transaction completion handler on the main queue?