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

Retain cycle in ParallaxView? #26

Open
yonicsurny opened this issue Feb 22, 2024 · 0 comments
Open

Retain cycle in ParallaxView? #26

yonicsurny opened this issue Feb 22, 2024 · 0 comments

Comments

@yonicsurny
Copy link

Hi, I'm experiencing what appears to be memory leaks using ParallaxView.

The more I use the app, the more unreleased closures are kept in memory.

A2953589-ED29-4C0B-B454-05364C5C3489

In my cell, I have a ParallaxView and I use a similar code as the one given in README of the project.

Relevant excerpt of the code:

@IBOutlet weak var posterView: ParallaxView!

...

override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
      super.didUpdateFocus(in: context, with: coordinator)
      coordinator.addCoordinatedAnimations { [weak self] in
          guard let self = self else { return }
          if context.nextFocusedView == self {
              self.posterView.addParallaxMotionEffects()
              UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseOut) {
                  self.posterView.transform = CGAffineTransform(scaleX: 1.1, y: 1.1)
              }
          }
          if context.previouslyFocusedView == self {
              self.posterView.removeParallaxMotionEffects()
              UIView.animate(withDuration: 0.3, delay: 0, options: .curveLinear) {
                  self.posterView.transform = CGAffineTransform(scaleX: 1, y: 1)
              }
          }
      }
  }

Any idea what might be the issue?
Thank you in advance!

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

No branches or pull requests

1 participant