Magnetic icon indicating copy to clipboard operation
Magnetic copied to clipboard

How to deallocate memory?

Open Marcin951 opened this issue 6 years ago • 1 comments

New Issue Checklist

Issue Description

It can take a lot of memory (about 400Mb) and CPU 50%, how I can delete magnetic when the user doesn't need it? magnetic!.removeAllChildren() magnetic!.removeFromParent() magnetView.removeFromSuperview() It doesn't help https://imgur.com/a/Xy3NM5q screens after open view with magnetic views And implementation of magnetic view (i have 4 magnetic views there, but user needs it only for a while, also i have this with tab bar so i'm not able to dismiss view) @IBOutlet weak var magneticView: UIView! @IBOutlet weak var nextMagneticButton: UIButton! weak var magnetic: Magnetic? var magnetView: MagneticView! func loadMagnetic(){ view.removeGestureRecognizer(tapGesture) magnetView = MagneticView(frame: self.magneticView.bounds) magnetView.backgroundColor = .clear magnetic = magnetView.magnetic magnetic!.magneticDelegate = self self.magneticView.addSubview(magnetView) self.magneticView.bringSubviewToFront(nextMagneticButton) magnetic!.backgroundColor = .clear for i in 0..<stylesText.count{ let node = Node(text: stylesText[i], image: nil, color: UIColor.init(hexFromString: "FFFFFF", alpha: 0.15), radius: 50) self.magnetic!.addChild(node) }

Environment

  • iOS Version: [13.3.1]
  • Device(s): [iPhone XS Max]

Marcin951 avatar Feb 08 '20 15:02 Marcin951

I commented out this chunk of code, now memory is released once the magnetic goes out of scope. File: MagneticView, line: 32

func commonInit() {
//        accessibilityCreateSelectionRotor(withName: "Selected", usingScene: magnetic)
    }

rimalamir avatar Dec 04 '22 18:12 rimalamir