I have a UILabel and its attirbutedText value is set to something like "8 km/h" and is changing succesfully to other similar values. Later I want to set the attributedText with value of "-". I am dispatching the update on the main queue. The code for the update is called but it never updates on the screen and the previous assigned value stays.
controller.speedValueLabel.attributedText = NSAttributedString(string: "-")
One way to call this code is when tapping a button. When this happens the label updates with "-". Another way is in the block of a timer. The timer is started and stopped on the main thread. When it fires it does nothing and the UILabel is just not updated. I tried with similar timer (but another one) and it also updated succesfully. What can be wrong?
The issue is now fixed. It turned out that there was previous update on the same UILabel that was made on a background thread. It also did not update the label. Then even though the new update was done on the main thread it was not working. Maybe because the value was the same as the one that was set on a background thread.