Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Expose styling options for the user location annotation. - #403

Merged
fabian-guerra merged 7 commits into
masterfrom
fabian-update-ul-style
Sep 3, 2020
Merged

fabian-guerra merged 7 commits into
masterfrom
fabian-update-ul-style

Conversation

@fabian-guerra

@fabian-guerra fabian-guerra commented Aug 31, 2020 •

Copy link
Copy Markdown
Contributor

Fixes #385

Styling example:

Halo

puck_halo

Arrow

arrow

Puck

puck

Approximate

aproximate

Comment thread platform/ios/src/MGLMapViewDelegate.h Outdated

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.

MGLUserLocationStyle appears to be specific to MGLFaux3DUserLocationAnnotationView. If the developer provides a custom view in -mapView:viewForAnnotation:, the return value of this method is ignored. Is there a more generic way to make MGLFaux3DUserLocationAnnotationView more stylable? How about a simple delegate method that says the view will get updated based on a new location? Or more generically, a method that says any annotation view will be updated by the map view?

@fabian-guerra fabian-guerra Sep 1, 2020 •

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.

You are right. This delegate method will be ignored if the users implements a custom location annotation view. We use a single annotation view to render four types of visual representations. Using a styling object was IMO the best tradeoff to handle this. I am not sure we may want to change rendering individually each visual representation for Hydrogen.

Perhaps changing the name to mapViewStyleForDefaultUserLocationAnnotationView: may sound more explicit?

@captainbarbosa captainbarbosa left a comment

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.

Don't forget the changelog 🙃

Comment thread platform/ios/app/MBXViewController.m Outdated

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.

How would you envision this working if the developer wanted to dynamically change the default user location annotation color? When we make an ios-sdk-examples entry for this, we should highlight this kind of use case.

Comment thread platform/ios/src/MGLMapViewDelegate.h Outdated

@captainbarbosa captainbarbosa Sep 1, 2020 •

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 method should be documented. If we don't want the documentation to appear in the API guides, prepend the documentation entry with :nodoc:.

In the documentation, we should note that setting the map view's tintColor does not have an effect on this default user location annotation color, as it once did.

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.

This was a work in progress. I added the documentation.

Comment thread platform/ios/src/MGLMapView.h Outdated

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.

I would encourage documenting each of these properties so that the developer has a good sense of what parts of the user location annotation are changing - some things like the approximate properties are new and perhaps not widely understood yet.

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.

I added the documentation.

@captainbarbosa captainbarbosa left a comment

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.

Thanks for adding additional documentation, this is very helpful. I have two minor concerns but otherwise this looks good.

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.

The puck view's fill color.

or, since the possessive form of "view" feels odd here, maybe:

The fill color for the puck view.

*/
@property (nonatomic) UIColor *haloFillColor;
/**
The approximate's view halo fill color.

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.

I think The halo fill color for the approximate view makes more sense (and for the rest of the properties below).

/**
The approximate's view halo fill color.
*/
@property (nonatomic) UIColor *approximateHaloFillColor;

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.

Should we note that any properties for the approximate view will only work in iOS 14+ when the user has enabled approximate location?

@fabian-guerra
fabian-guerra merged commit f1d117b into master Sep 3, 2020
@fabian-guerra
fabian-guerra deleted the fabian-update-ul-style branch September 3, 2020 00:14
katydecorah pushed a commit that referenced this pull request Sep 4, 2020
* master:
  Release 6.2.0 beta.1 prep (#417)
  Update for Xcode 12 release (#415)
  Switch background snapshot to periodic. (#412)
  Fix map stuttering by switching render call to use setNeedsDisplay (#411)
  Add a flag to enforce using catched tiles (#416)
  Improve header documentation for MGLObservable (#398)
  Expose styling options for the user location annotation. (#403)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore: Expose styling for default user location view

4 participants