mapbox / mapbox/mapbox-navigation-ios
NavigationServieDelegate implementation
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 918
- Forks
- 326
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 3
Description
NavigationServieDelegate says:
"A navigation service coordinates various nonvisual components that track the user as they navigate along a predetermined route. You use `MapboxNavigationService`, which conforms to this protocol, either as part of `NavigationViewController` or by itself as part of a custom user interface. A navigation service calls methods on its `delegate`, which conforms to the `NavigationServiceDelegate` protocol, whenever significant events or decision points occur along the route."
My understanding of this is that I can receive navigation service events regardless of the navigationViewController.
I tried to hook this delegate in a seperate instance to show a floating directions outside of navigation view.
But none of the methods are called.
In the sample, I see you are using a custom top instruction banner and attach it to the navigationViewController hirarchy, is this something I must do to connect to this delegate ? because what I'm looking to achieve is have two top banner views one as part of the navigationviewController when the user is inside the navigation view and another when he exits this view but stays in "navigation" mode. Customizing the actual view is not something I'm interested in for now.
this is my related code, am I missing something?
`let indexedRouteResponse = IndexedRouteResponse(routeResponse: response, routeIndex: 0)
let navigationService = MapboxNavigationService(indexedRouteResponse: indexedRouteResponse,
customRoutingProvider: NavigationSettings.shared.directions,
credentials: NavigationSettings.shared.directions.credentials,
simulating: .onPoorGPS)
navigationService.delegate = self
let navigationOptions = initNavigatgionOptions(navigationService: navigationService, routeOptions: routeOptions)
//custom top banner
//let topBanner = CustomTopBarViewController()
//navigationOptions.topBanner = topBanner
self.navService = navigationService
self.navOptions = navigationOptions
self.navigationViewController = NavigationViewController(for: indexedRouteResponse, navigationOptions: self.navOptions!)`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the NavigationServiceDelegate, MapboxNavigationService, and NavigationViewController entry points referenced in the issue, then trace how the delegate is connected when the navigation view controller is created. Reproduce the reported setup and determine whether delegate callbacks work outside the navigation view hierarchy; done means the expected navigation service events are documented or reliably delivered in that setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100