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

Crash for iOS 13 #11

Open
topDev15 opened this issue Dec 5, 2019 · 1 comment
Open

Crash for iOS 13 #11

topDev15 opened this issue Dec 5, 2019 · 1 comment

Comments

@topDev15
Copy link

topDev15 commented Dec 5, 2019

class NodeRenderer {

weak var view: MView?

fileprivate let onNodeChange: () -> Void
fileprivate let disposables = GroupDisposable()
fileprivate var active = false
weak var animationCache: AnimationCache?

init(node: Node, view: MView?, animationCache: AnimationCache?) {
    self.view = view
    self.animationCache = animationCache

    onNodeChange = { [unowned node, weak view] in
        guard let isAnimating = animationCache?.isAnimating(node) else {
            return
        }

        if isAnimating {
            return
        }

            DispatchQueue.main.async {
            print("setNeedsDisplay=6")
                view?.setNeedsDisplay()
            }
    }

    addObservers()
}

view?.setNeedsDisplay() needs to be wrapped with DispatchQueue.main.async {}.
If not, we have crash for iOS 13.
But after we wrap it, it is very slow when changing color of shape.
I found the reason.
When changing color of shape, this framework is doing rerendering for whole group using group rendering.
Now it needs to be called for main thread as you can see above.
But the speed is very slow because of calling main thread much time.
How can we fix this issue?
Please let me know if you have any thought.

@museum-future
Copy link

Did you get a fix?

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

2 participants