Skip to content

Can I ignore Perception warning if the change is detected well in this case ? #2927

Answered by stephencelis
teamboot88 asked this question in Q&A
Discussion options

You must be logged in to vote

@teamboot88 This is unfortunately to be expected since you're accessing things in a custom binding using Binding.init(get:set:) instead of deriving a binding via dynamic member lookup. You can instead leverage dynamic member lookup on bindings of stores by defining computed properties or subscripts. I think you could do the above as a subscript that takes an alcohol frequency:

extension StoreOf<ProfileFilterFeature> {
  subscript(alcoholFrequency alcoholFrequency: AlcoholFrequencyType?) -> Bool {
    get { self.alcoholFrequency[alcoholFrequency] ?? false }
    set { send(.setAlcoholFrequency(alcoholFrequency: alcoholFrequency)) }
  }
}

And then in the view, instead of a custom binding:

To…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@teamboot88
Comment options

Answer selected by teamboot88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants