Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI not updating when called on main thread Swift

I am having a hard time getting my annotation's subtitle to update, I am calling it on the main thread and ensuring that the result is correct.

Can anyone see why it would not be updating?

 let stopAnnotation: UUStopAnnotation = view.annotation as! UUStopAnnotation

        // Else get the stop estimation
        webService?.getStopEstimation(routeId: stopAnnotation.routeId, stopId: stopAnnotation.stopId, completion: { (result) in

            print(result)
            DispatchQueue.main.async(execute: {
                stopAnnotation.subtitle = result
            })

        })
like image 827
Clip Avatar asked Oct 20 '25 15:10

Clip


1 Answers

You can't change an annotation in the map. Remove this annotation and replace it with one that has the same coordinates but the new subtitle.

like image 180
matt Avatar answered Oct 23 '25 05:10

matt