[ios] Adds guides to documentation sidebar#7488
Conversation
|
@ericrwolfe, thanks for your PR! By analyzing this pull request, we identified @friedbunny, @incanus and @1ec5 to be potential reviewers. |
1ec5
left a comment
There was a problem hiding this comment.
Wow, I’m excited about these guides! This will go a long way towards helping developers move beyond MapKit-style, Core Graphics–based customization.
We’ll need to be careful about how we explain the pros and cons of the three different ways to present point data to the user.
| The Mapbox iOS SDK is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 7.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. | ||
|
|
||
|  | ||
|  |
There was a problem hiding this comment.
Also update platform/ios/README.md (shown on GitHub) and platform/ios/docs/pod-README.md (bundled with the SDK as README.md and also shown on CocoaPods.org).
| * Custom, native UIViews | ||
| * Full support for animations | ||
| * Familiar API to MapKit | ||
| * Relative control over z-ordering using the `zPosition` property on `CALayer` |
There was a problem hiding this comment.
Another benefit is that there’s no limit to the number or size of the images you put in annotation views. The way I like to think about it is that non-view-backed annotations are optimized for extreme reuse, whereas view-backed annotations are better for situations where every annotation is unique. ❄️
There was a problem hiding this comment.
Here’s a good opportunity to include a bulleted list of concrete scenarios that would be best served by annotation views (and likewise for the other two APIs). For example:
You want to display all your users’ locations on the map with their profile pictures. Each user has a different picture. Tapping on a user brings up their profile.
| **Cons** | ||
|
|
||
| * Currently you must implement your own tap gesture recognizer together with `MGLMapView.visibleFeaturesAtPoint` to recognize taps and manually show callouts ([example](http://mapbox.com/ios-sdk/examples)). | ||
| * Currently no SDK support for animations. If you need animations, consider running your own CADisplayLink and updating the layer properties accordingly. |
There was a problem hiding this comment.
Is CADisplayLink a good idea here? MGLMapView already uses a CADisplayLink to tie its own refresh rate to that of the screen, so I wonder whether there would be any interplay between the two. CADisplayLink is also a tricky class to work with; it’s easy to end up leaking memory. Maybe using an NSTimer would be better advice.
|
|
||
| ### Map interactivity | ||
|
|
||
| You can customize the map to the point of having it respond dynamically based on the actions your users are taking. Increase the text size of streets while a user is driving, emphasize points of interest tailored a user's preferences, change your UI if user are near parks, trails, landmarks, or rivers. |
There was a problem hiding this comment.
Typo: “tailored a user’s preferences”.
|  | ||
|  | ||
|
|
||
| ### Powerful Annotations |
There was a problem hiding this comment.
Section headings in the API reference pages use title case, for consistency with Apple documentation. Most of the section headings here use sentence case, but “Powerful Annotations” is in title case. I’d be in favor of switching to sentence case across the board, but for now let’s be consistent within guides with either sentence or title case.
| ## Resources | ||
|
|
||
| * [Mapbox style spec](https://www.mapbox.com/mapbox-gl-style-spec/) | ||
| * [Mapbox studio](https://www.mapbox.com/mapbox-studio/) |
There was a problem hiding this comment.
Capitalize “Mapbox Style Specification” and “Mapbox Studio”.
| For example, if you're looking to prototype points of interest, consider the `poi_label` layer; if you want to style GPS traces, the `roads` layer might be a good proxy. Take a look at what's available in [Mapbox Streets](https://www.mapbox.com/studio/tilesets/mapbox.mapbox-streets-v7/): there's probably a layer that closely matches your data. | ||
|
|
||
| ### Importing real data | ||
| If you can't find a good approximate for your data in Mapbox Streets, consider uploading a small subset of your data into Mapbox Studio as a custom tileset. |
| ### Faking placeholder data | ||
| If you don't have any custom data on hand in a format that works easily with the Tileset importer, you can fake placeholder data with the Dataset Editor. | ||
|
|
||
| Head to [mapbox.com/studio/dataset](https://www.mapbox.com/studio/datasets/) and click on `New Dataset` to get started. |
There was a problem hiding this comment.
Instead of inlining the URL, perhaps we could explain how to get to this page.
|
|
||
| * Text along a line: add line with a text property | ||
| * Text at specific points on a line or polygon: in addition to the line, create points at the specific points you'd like with text properties | ||
| * If you want circles where scale doesn't matter relative to the geography (e.g. always 20 pixels), you can add as a point and style with a circle layer or a symbol |
There was a problem hiding this comment.
This might be a good opportunity to relate geometry types to specific MGLShape or MGLFeature classes, since the developer may need to create these shapes programmatically after they’re done prototyping in Studio.
There was a problem hiding this comment.
I think this would be a great idea for another guide 😄.
| @@ -0,0 +1,56 @@ | |||
| # Dynamically Styling Maps | |||
There was a problem hiding this comment.
The name of this file determines what appears in the navigation sidebar, so it and this heading should match.
7e2fea7 to
2497f4e
Compare
| @@ -0,0 +1,57 @@ | |||
| # Runtime Styling | |||
|
|
|||
| Mapbox's runtime styling features allow you direct control over every layer in your maps with code. It's now possible create dynamic maps and visualizations that aren't possible with other mobile maps SDKs. | |||
There was a problem hiding this comment.
Typo: now possible to create.
Also, “mobile map SDKs” sounds slightly better.
|
|
||
| <!-- TODO: custom storm tracks --> | ||
| <!-- TODO: metro system --> | ||
| <!-- TODO: indoor maps --> |
There was a problem hiding this comment.
Can you replace or remove these TODOs as tail work?
| 1. Implement `MGLMapViewDelegate` `-mapView:didFinishLoadingStyle:` | ||
| 2. Add your real data as a source | ||
| * This can be done using vector data from tileset editor ([example](https://www.mapbox.com/ios-sdk/examples/runtime-circle-styles)), custom vector tiles, added as GeoJSON ([example](https://www.mapbox.com/ios-sdk/examples/runtime-add-line), or added manually through the app via `MGLShapeSource` ([example](https://www.mapbox.com/ios-sdk/examples/runtime-multiple-annotations)) | ||
| 3. For each layer you've prototyped in studio, add it's corresponding `MGLStyleLayer` subclass: `MGLSymbolStyleLayer`, `MGLLineStyleLayer`, `MGLFillStyleLayer`, or `MGLCircleStyleLayer`. |
There was a problem hiding this comment.
#7542 will end up linking this page to the new “Information for Style Authors” guide.
There was a problem hiding this comment.
Not sure if you meant to link to the Mapbox Studio guide from #7542 or vise versa. I rebased, so feel free to update as you intended.
|
Added these extra changes over in #7542. |
3 guides to start, focused around runtime styling:
Also improves the way we organize guides and documentation images in the repo.
We should think about a good way to share these between the SDK docs and the /help section of the website.
TODO:
/cc @friedbunny @captainbarbosa @1ec5