-
Notifications
You must be signed in to change notification settings - Fork 161
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
[examples] Add SwiftUI example #78
Conversation
I pushed a commit with some updates that I worked on today and went over with @captainbarbosa. I need to add some additional explanatory comments to the example before this is merged. My commit also removes the annotations aspect of the example. I'd like to review that part with @julianrex and @nishant-karajgikar to see if we can come up with something a bit more declarative. |
8e51a9d
to
529cbe9
Compare
public enum StyleURL { | ||
public enum StyleURL: Hashable { |
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.
This is a minor SDK modification which made the example easier to write.
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.
👍🏻
@julianrex @ZiZasaurus this is ready for re-review. Please read the documentation I added to make sure it is clear. Let me know if you'd like to chat about it. |
529cbe9
to
959067d
Compare
959067d
to
0685168
Compare
/// We configure the slider to bind to the camera's zoom. Adjusting the slider with | ||
/// change the zoom on the map, and changing the zoom by interacting with the map | ||
/// will change the slider. Here's the data flow: | ||
/// | ||
/// Slider to Map: | ||
/// - User interacts with the slider | ||
/// - Slider updates the camera binding's zoom value |
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.
Did something happen with indents here?
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.
This is how Xcode likes it. The comments are aligned to the indentation of the next line of code.
/// Slider to Map: | ||
/// - User interacts with the slider | ||
/// - Slider updates the camera binding's zoom value | ||
/// - SwiftUI invokes `updateUIView(_:context:)` on `SwiftUIMapView` | ||
/// - `SwiftUIMapView` reads the updated camera zoom value and sets it on the underlying `MapView` | ||
/// | ||
/// Map to Slider: | ||
/// - User interacts with the map, adjusting the zoom | ||
/// - Map sends the `.cameraDidChange` event, which is observed by the coordinator | ||
/// - The coordinator updates the value of the zoom on the `camera` binding | ||
/// - SwiftUI updates the Slider accordingly |
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.
Thanks for clarifying the flow here - definitely helps
public enum StyleURL { | ||
public enum StyleURL: Hashable { |
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.
👍🏻
5cf2afd
to
8cede27
Compare
PRs must be submitted under the terms of our Contributor License Agreement CLA.
Pull request checklist:
mapbox-maps-ios
changelog:<changelog>Added SwiftUI example.</changelog>
.Summary of changes
Adds a new example that illustrates how to wrap a
MapView
inside a SwiftUI view.cc @mapbox/maps-ios