Skip to content

Configurable nav and non-nav location managers#856

Open
hactar wants to merge 5 commits intostadiamaps:mainfrom
hactar:pr/configurable-navigation-location-managers-main
Open

Configurable nav and non-nav location managers#856
hactar wants to merge 5 commits intostadiamaps:mainfrom
hactar:pr/configurable-navigation-location-managers-main

Conversation

@hactar
Copy link
Copy Markdown
Contributor

@hactar hactar commented Mar 28, 2026

This PR requires maplibre/swiftui-dsl#142 to actually work.

With our current set up it is difficult to achieve the following:

  • in non navigation mode, have a current location puck and default maplibre puck/location behavior
  • in navigation mode, have the snapping locations/puck in place
  • switch between them

This PR addresses this by allowing you to specify which manager to use in which mode, and provides sane defaults when you don't: maplibre default when not navigating, ferrostar specific one when navigating.

Before change: (notice the current location puck not visible before navigating)
https://github.com/user-attachments/assets/9b784deb-bfe0-456a-8120-61dd3c613fc1

After change: (puck now visible before navigation)
https://github.com/user-attachments/assets/fe2f846a-e8aa-4844-9cb7-dc0cae796072

Copy link
Copy Markdown
Contributor

@ianthetechie ianthetechie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the specific comment, I think that the environment approach would clean things up a lot and result in less code.

self.onStyleLoaded = onStyleLoaded
userLayers = makeMapContent()
self.activity = activity
_navigatingLocationManager = State(initialValue: locationManagerConfiguration.navigatingLocationManager)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is a bit confusing. You create an explicit state wrapper here with an initial value, but below on line 126 you're accessing the configuration property directly to get the non navigating location manager.

I'm not quite sure all the plumbing here is correct, basically.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - I've changed the plumbing.

@hactar hactar requested a review from ianthetechie March 31, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants