Skip to content

Conversation

@devpolant
Copy link

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