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

Fix Swipe Actions Bug #136

Merged
merged 2 commits into from
May 15, 2020
Merged

Conversation

kyleve
Copy link
Collaborator

@kyleve kyleve commented May 14, 2020

  • Fix bug when close swipe actions notification was posted too often, and setter did not check state.

@kyleve kyleve requested a review from kylebshr May 14, 2020 00:31
@@ -202,6 +202,11 @@ extension ItemElementCell {
}

private func set(state: SwipeActionState, animated: Bool = false) {
Copy link
Collaborator Author

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.
@kyleve
Copy link
Collaborator Author

kyleve commented May 15, 2020

Going to land this so I can continue with some other refactors that would conflict – still need to figure out the Q above

@kyleve kyleve merged commit 0aca42a into master May 15, 2020
@kyleve kyleve deleted the kve/move-close-swipe-notification-to-will-begin branch May 15, 2020 02:29
@kyleve
Copy link
Collaborator Author

kyleve commented May 15, 2020

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 {
Copy link
Collaborator Author

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.

@kyleve
Copy link
Collaborator Author

kyleve commented May 15, 2020

Fix for this breaking ongoing swipe handling: #140

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

Successfully merging this pull request may close these issues.

1 participant