CollectionThing icon indicating copy to clipboard operation
CollectionThing copied to clipboard

Modifying state during view update, this will cause undefined behavior.

Open plivesey opened this issue 6 years ago • 3 comments

I got this runtime warning while running the code. I got this for one of my other preference changes. The only way I could get rid of this warning was to to add a DisapatchQueue.main.async which I know you don't want to do.

It seems to occur whenever the view changes because of an observed object changing. I haven't tried to reproduce this yet.

plivesey avatar Nov 21 '19 18:11 plivesey

Screen Shot 2019-11-21 at 10 30 08 AM

plivesey avatar Nov 21 '19 18:11 plivesey

Try with: DispatchQueue.main.async { // code to execute }

itrack avatar Feb 12 '20 13:02 itrack

Yep, that's what I'm doing in my code base. It's just that @liscio seemed to want to avoid using any dispatches (No weird uses of DispatchQueue.async - README)

plivesey avatar Feb 13 '20 01:02 plivesey