-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Navigation #39
Support Navigation #39
Conversation
* updating tests * adding pitch setup for initial load * renaming CameraPitch * pitch workaround for initial load * format improvements * fixing tests * linting
commit 857c1ce Author: PW <[email protected]> Date: Wed May 15 14:02:58 2024 +0200 adding example commit ea40ab1 Author: PW <[email protected]> Date: Wed May 15 13:49:24 2024 +0200 adding expand clusters modifier
…i-dsl-playground into enhancement/navigation-without-sheet
Looks like there's a merge conflict now. Could you fix that real quick for me make it easier to review? GitHub appears to just throw up its hands and gives a useless diff now 😂 |
Thanks for the PR @Patrick-Kladek! Taking a look over this concept, it looks like the generalized goal is to introduce the add the convenience of maplibre/mapbox’s NavigationViewController to the SwiftUI MapView? While there’s no harm in this approach, I think it’s a specialization that doesn’t align with the goals of this project. I’d propose this alternative:
I realize this may not be as convenient as just swapping out the MLNMapView, but having used Mapbox’s navigation without the full view controller in my own iOS app, I think it would actually be relatively reasonable to follow that process, even if it was just in your app implementation. Feel free to reach out over Slack, happy to dive in, discuss in more detail and provide some examples of how I've done the above myself before. |
…i-dsl-playground into enhancement/unify-navigation
@ianthetechie just fixed the merge conflicts |
5da79ef
to
565da23
Compare
I have adjusted the PR to include a convenience init so that the call site no longer changes if you do not need a UIViewController backing, so the old As for aligning with project goals: I do agree that a specialization towards MapLibre Navigation is not a project goal. But I don't think this is was this PR is. In this revised PR, the call site for all existing users does not change - for anyone who does not need a UIViewController based backing, nothing changes. But for anyone who does, for example to include a UIViewController based navigation system such as MapLibre Navigation, this PR opens up this possibility. This is also not the only reason someone might need a UIViewController backed system: UIViewController offers all that UIView does, plus more, and UIViewRepresentable is just a convenience for UIViewControllerRespresentable I would argue - which is more powerful. In other words, personally I do not see this PR as a specialization, but as a generalization, and now swiftly hidden behind a convenience init :). We thought of some other alternatives and tried discussing them here: https://osmus.slack.com/archives/C06U5MM097B/p1717157153623649 Maybe we can discuss this in one of the calls on Wednesday? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looking pretty good 👍. Have a couple of easy questions and suggestions.
Description
Allows to use maplibre-navigation-ios with SwiftUI without duplicating targets or source code. We think this is the best way given the following requirements:
Tasks
Infos for Reviewer
Note #37 should be merged first as this PR contains the changes already.
Relevant changes are in files:
MapView.swift
MapViewController.swift
MapViewCoordinator.swift
MapViewModifiers.swift
To make this work we are not using
UIViewRepresentable
, instead we are usingUIViewControllerRepresentable
and providing a default ViewController that has a mapView. This requirement is extracted into a protocolWrappedViewController
and allows to instantiate a MapView specifying the ViewController via Generics:Thats the only change needed if you want to continue using this Package without navigation support. However if you want to support navigation the following changes are needed:
Add this branch as a dependency to your project: maplibre/maplibre-navigation-ios#54