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

Fixed retain cycles between MacawView and MacawZoom #716

Merged
merged 2 commits into from
Jul 20, 2020

Conversation

devpolant
Copy link
Contributor

Updates

In this pull request I fixed 2 issues:

  • retain cycle between MacawView and MacawZoom: both classes referenced to each other using strong reference which produced retain cycle previously.
    Solution is easy - just to use some weak / unowned reference.

  • implicit retain cycle with onZoomChange method. As we know - self is also implicitly captured when we pass method as closure.
    So instead of directly passing method name as closure - zoom.initialize(view: self, onChange: onZoomChange) we have to wrap it into additional closure with [weak self] parameter in capture list:

zoom.initialize(onChange: { [weak self] transform in
    self?.onZoomChange(t: transform)
})

@ystrot
Copy link
Member

ystrot commented Jul 17, 2020

Looks good for me. @f3dm76 could you please review this PR as well?

@ystrot ystrot added this to the 0.9.7 milestone Jul 17, 2020
@ystrot ystrot merged commit 62c9cc0 into exyte:master Jul 20, 2020
@devpolant devpolant deleted the bugfix/zoom-retain-cycles branch August 3, 2020 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants