-
Notifications
You must be signed in to change notification settings - Fork 50
Crash for iOS 13 #11
Copy link
Copy link
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels