@@ -378,30 +378,38 @@ class NavigatorElectronicHorizonObserver: ElectronicHorizonObserver {
378378 . updatesMostProbablePathKey: position. type ( ) == . update,
379379 . distancesByRoadObjectKey: distances. map ( DistancedRoadObject . init) ,
380380 ]
381- NotificationCenter . default. post ( name: . electronicHorizonDidUpdatePosition, object: nil , userInfo: userInfo)
381+ onMainAsync {
382+ NotificationCenter . default. post ( name: . electronicHorizonDidUpdatePosition, object: nil , userInfo: userInfo)
383+ }
382384 }
383385
384386 public func onRoadObjectEnter( for info: RoadObjectEnterExitInfo ) {
385387 let userInfo : [ RoadGraph . NotificationUserInfoKey : Any ] = [
386388 . roadObjectIdentifierKey: info. roadObjectId,
387389 . didTransitionAtEndpointKey: info. isEnterFromStartOrExitFromEnd,
388390 ]
389- NotificationCenter . default. post ( name: . electronicHorizonDidEnterRoadObject, object: nil , userInfo: userInfo)
391+ onMainAsync {
392+ NotificationCenter . default. post ( name: . electronicHorizonDidEnterRoadObject, object: nil , userInfo: userInfo)
393+ }
390394 }
391395
392396 public func onRoadObjectExit( for info: RoadObjectEnterExitInfo ) {
393397 let userInfo : [ RoadGraph . NotificationUserInfoKey : Any ] = [
394398 . roadObjectIdentifierKey: info. roadObjectId,
395399 . didTransitionAtEndpointKey: info. isEnterFromStartOrExitFromEnd,
396400 ]
397- NotificationCenter . default. post ( name: . electronicHorizonDidExitRoadObject, object: nil , userInfo: userInfo)
401+ onMainAsync {
402+ NotificationCenter . default. post ( name: . electronicHorizonDidExitRoadObject, object: nil , userInfo: userInfo)
403+ }
398404 }
399405
400406 public func onRoadObjectPassed( for info: RoadObjectPassInfo ) {
401407 let userInfo : [ RoadGraph . NotificationUserInfoKey : Any ] = [
402408 . roadObjectIdentifierKey: info. roadObjectId,
403409 ]
404- NotificationCenter . default. post ( name: . electronicHorizonDidPassRoadObject, object: nil , userInfo: userInfo)
410+ onMainAsync {
411+ NotificationCenter . default. post ( name: . electronicHorizonDidPassRoadObject, object: nil , userInfo: userInfo)
412+ }
405413 }
406414}
407415
0 commit comments