square/Listable

Figure out swipeState setting inconsistency

kyleve opened this issue · 2 comments

@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?

Originally posted by @kyleve in #136

Crap, forgot to look at this today. I’m on a walk rn but will take a look tonight

The behavior is pretty much the same, since the function sets the property which triggers the didSet. I'm not actually sure how the setter could just call the function, since the function sets state - it would be recursive. If the function didn't need to store the state, it could work that way, but since it needs to store the value I think that's why it's set up how it is?