-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix Swipe Actions Bug #136
Fix Swipe Actions Bug #136
Conversation
kyleve
commented
May 14, 2020
- Fix bug when close swipe actions notification was posted too often, and setter did not check state.
…nd setter did not check state.
@@ -202,6 +202,11 @@ extension ItemElementCell { | |||
} | |||
|
|||
private func set(state: SwipeActionState, animated: Bool = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kylebshr: One question I have is that I'm surprised this setter method and the property's didSet are different:
private var swipeState: SwipeActionState = .closed {
didSet {
if oldValue != swipeState {
swipeConfiguration?.swipeView.apply(state: swipeState)
}
}
}
Based on UIKit paradigm, I'd simply expect the didSet
to call through to a set(state: newValue, animated:false)
. If the behaviour is meant to be meaningfully different, should the name of this method be different?
…begin * master: Remove HeaderFooterAppearance and merge it into HeaderFooterElement. Update isSelected in setNew(item:) Simplify List element implementation Support background views and selected background views within ItemElements. Remove ItemElementAppearance, as it was never functonally different from ItemElement itself. Add a bunch of docs that were missing.
Going to land this so I can continue with some other refactors that would conflict – still need to figure out the Q above |
Ugh, wait, this may have broken the swipe animation, I think. Going to revert... |
@@ -202,6 +202,11 @@ extension ItemElementCell { | |||
} | |||
|
|||
private func set(state: SwipeActionState, animated: Bool = false) { | |||
|
|||
guard swipeState != state else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ha, turns out this breaks the general case which causes the bug. Sometimes, this should always be called, and other times, it should only be called if the value changed.
Fix for this breaking ongoing swipe handling: #140 |