Skip to content

Crash for iOS 13 #11

@topDev15

Description

@topDev15

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions