0

I have a situation at hand. I have a designerDress:BehaviourRelay<[MyCustomObjects]> Already implemented in code which drives few UI components.

Now I have a requirement to reorder the array which is simple

let tempArray = designerDress.value
//tempArray.reorderAsperMywish()
designerDress.accept(tempArray)

But now it recreates the UI components. My question is how can I prevent or trap a particular accept from emitting?

amar
  • 4,285
  • 8
  • 40
  • 52
  • So to be clear, you *don't* want the UI to be a function of the state? If so, you can't have the UI updating when the state changes. – Daniel T. May 17 '23 at 11:40
  • Why are you changing the `designerDress` if you don't want to change the UI? – Daniel T. May 17 '23 at 11:40
  • I'm asking the above questions because what you are asking for is like asking to change the value of a String but having it return the old value when queried. – Daniel T. May 18 '23 at 21:12
  • @DanielT. sorry for the delayed response. Actually its a old code in which it is assumed that only unique lements will be a added into array which will be accepted in relay but reordering was new requirement which was accepteing objects which where already accepted once before causing some duplication on VC. I refactored the code entirely as a quick fix would have been harmful. Thanks for your question I also agreed that its not good to go against very behaviour of Behaviour Relay – amar May 19 '23 at 03:31

0 Answers0