ZLSwipeableViewSwift
ZLSwipeableViewSwift copied to clipboard
animateView is called extra times
Closure swipeableView.animateView
is called multiple times. In my case with numberOfActiveView
equal to 2 swipeableView.animateView
is called 3 times for 1st view and 3 times for 2 view. This is incorrect, the correct behaviour should be 1 time per view.
As I found in your code it happens because of this:
open var nextView: NextViewHandler? {
didSet {
loadViews()
}
}
open func loadViews() {
for _ in UInt(activeViews().count) ..< numberOfActiveView {
if let nextView = nextView?() {
insert(nextView, atIndex: 0)
}
}
updateViews()
}
actually as I understand these lines are the root cause (they create a loop and updateViews()
method is called 3 times instead of 1):
if let nextView = nextView?() {
didSet { loadViews() }
Thank you for investigating 🙃
I'd be more than happy to accept a Pull Request that fixes the behavior!
@denirorobert @AndrewSB Hello. Did you found the solution of this problem?