summaryrefslogtreecommitdiff
path: root/ios/README.md
blob: 2af03691e250d8d85c1044a37ea69b56e9f0aad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Mapbox GL for iOS

Use or edit this project to get access to vector maps (via [Mapbox Vector Tiles](https://www.mapbox.com/blog/vector-tiles)) and dynamic OpenGL-based styling in your iOS apps by using `MGLMapView`. 

![](./screenshot.png)

## Installation

Currently in flux. See the parent `mapbox-gl-native` project `README` for details on building this library yourself. 

Static and dynamic prebuilt binaries are coming back, as is CocoaPods support. 

## Example usage

### Objective-C

```objective-c
MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)
                                            accessToken:@"<access token string>"];

[mapView setCenterCoordinate:CLLocationCoordinate2DMake(28.369334, -80.743779) 
                   zoomLevel:13 
                    animated:NO];

[mapView useBundledStyleNamed:@"outdoors"];

[self.view addSubview:mapView];
```

### Swift

```swift
let mapView = MGLMapView(frame: CGRect(x: 0, y: 0, width: 400, height: 400),
                         accessToken: "<access token string>")

mapView.setCenterCoordinate(CLLocationCoordinate2D(latitude: 46.049900, longitude: -122.095678),
        zoomLevel: 12,
        animated: false)

mapView.useBundledStyleNamed("outdoors")

view.addSubview(mapView)
```

## Development

If you'd like to contribute to this project, go up to [Mapbox GL native](https://github.com/mapbox/mapbox-gl-native) and clone the project. 

## Testing

Currently in flux and not functioning. 

## Requirements

 * iOS 7+
 * a sense of adventure

## Styling

See the [online style reference](https://www.mapbox.com/mapbox-gl-style-spec/) for the latest documentation. Contained within the `MapboxGL.bundle` assets are a couple of starter styles in JSON format. 

The project will eventually get a programmatic styling API as well. 

## Related Projects

 * https://github.com/mapbox/mapbox-gl-style-spec
 * https://github.com/mapbox/mapbox-gl-js
 * https://github.com/mapbox/vector-tile-spec