Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread

I finally found out the problem after taking another look at the stack trace. The problem was that I was changing the value property of a UISlider instance on a background thread.

But nowhere does it state that you have to change it on the main thread! (Thanks, Apple) Apparently, it seems like UISlider implements the value's setter and forces a layout or something similar.


Always for change at UI should be work on main thread. also an important subject is you can make an object from view at background thread!!! but for show in view or another changes on it just should be work on main thread, and this subject is main reason for occurrences this problem.

finally for solve this problem you can easily use from 'DispatchQueue'

DispatchQueue.main.async {
  // do your work
}