I'm using the Mapbox framework on iOS in Swift to create a custom NavigationViewController. I need help getting a reference to the FloatingStackView
on the NavigationView
.
I've added an additional button (see top left of screenshot) and I'd like to anchor it to the FloatingStackView on the right so that it moves up and down as the top banner changes (similar to the FloatingStackView behavior). The trouble is I can't seem to access the FloatingStackView. From what I've seen in the Mapbox source code the FloatingStackView
is a subview of a NavigationView
which is the view of a RouteMapViewController
which is the mapViewController
of a NavigationViewController. Trouble is I can't access the mapViewController as it is inaccessible due to internal protection level.
Here's an example of what I'd like to do:
import UIKit
import MapboxNavigation
class DemoNavigationViewController: NavigationViewController {
override func viewDidLoad() {
super.viewDidLoad()
let mapVC = mapViewController
// Do any additional setup after loading the view.
}
}
Here's the error on the let mapVC line:
'mapViewController' is inaccessible due to 'internal' protection level
My end goal would be to be able to access the FloatingStackView via something like this:
let navigationView = mapViewController.view as? NavigationView
let floatingStackView = navigationView.floatingStackView
If I can get a reference to that floatingStackView I think I can handle the layout.
How can I get around the is inaccessible due to 'internal' protection level
error or find another way to access the floating stack view?
From NavigationView class source code