summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/CHANGELOG.md58
-rw-r--r--platform/ios/DEVELOPING.md15
-rw-r--r--platform/ios/Mapbox.playground/Contents.swift115
-rw-r--r--platform/ios/app/MBXAppDelegate.h2
-rw-r--r--platform/ios/app/MBXViewController.m278
-rw-r--r--platform/ios/benchmark/MBXBenchAppDelegate.h2
-rw-r--r--platform/ios/docs/doc-README.md2
-rw-r--r--platform/ios/docs/pod-README.md2
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj34
-rw-r--r--platform/ios/scripts/configure.sh7
-rwxr-xr-xplatform/ios/scripts/package.sh19
-rw-r--r--platform/ios/src/MGLAnnotationImage.h24
-rw-r--r--platform/ios/src/MGLCalloutView.h36
-rw-r--r--platform/ios/src/MGLCompactCalloutView.h5
-rw-r--r--platform/ios/src/MGLMapView.h59
-rw-r--r--platform/ios/src/MGLMapView.mm28
-rw-r--r--platform/ios/src/MGLMapViewDelegate.h8
-rw-r--r--platform/ios/src/MGLUserLocation.h18
-rw-r--r--platform/ios/src/MGLUserLocationAnnotationView.h2
19 files changed, 505 insertions, 209 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 1b90d20999..89f301ea37 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -2,17 +2,29 @@
Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.
-## 3.3.3
+## master
+
+* As the user zooms in, tiles from lower zoom levels are scaled up until tiles for higher zoom levels are loaded. ([#5143](https://github.com/mapbox/mapbox-gl-native/pull/5143))
+* Added [quadkey](https://msdn.microsoft.com/en-us/library/bb259689.aspx) support and limited WMS support in raster tile URL templates. ([#5628](https://github.com/mapbox/mapbox-gl-native/pull/5628))
+* The `text-pitch-alignment` property is now supported in stylesheets for improved street label legibility on a tilted map. ([#5288](https://github.com/mapbox/mapbox-gl-native/pull/5288))
+* The `icon-text-fit` and `icon-text-fit-padding` properties are now supported in stylesheets, allowing the background of a shield to automatically resize to fit the shield’s text. ([#5334](https://github.com/mapbox/mapbox-gl-native/pull/5334))
+* Improved the performance of relocating a non-view-backed point annotation by changing its `coordinate` property. ([#5385](https://github.com/mapbox/mapbox-gl-native/pull/5385))
+* MGLMapDebugOverdrawVisualizationMask does nothing in Release builds of the SDK. This is disabled for performance reasons. ([#5555](https://github.com/mapbox/mapbox-gl-native/pull/5555))
+* Include simulator architecture slices in the dSYM file that is generated for release builds. ([#5740](https://github.com/mapbox/mapbox-gl-native/pull/5740))
+* Fixed an issue where annotation views could be assigned to multipoint annotations. ([#5770](https://github.com/mapbox/mapbox-gl-native/pull/5770))
+* Fixed the static only framework build. ([#5782](https://github.com/mapbox/mapbox-gl-native/issues/5782))
+
+## 3.3.3 - July 29, 2016
* Fixes an issue where the style zoom levels were not respected when deciding when to render a layer. ([#5811](https://github.com/mapbox/mapbox-gl-native/issues/5811))
-## 3.3.2
+## 3.3.2 - July 28, 2016
* Speculatively fixed a crash that occurred when initializing an MGLMapView on iOS 7.x. ([#5791](https://github.com/mapbox/mapbox-gl-native/pull/5791))
* View-backed annotations no longer prevent the user from starting to pan the map. ([#5813](https://github.com/mapbox/mapbox-gl-native/pull/5813))
* Fixed an issue that caused the user dot to be selected when tapping an annotation that lies within the user dot’s accuracy circle. ([#5816](https://github.com/mapbox/mapbox-gl-native/pull/5816))
-## 3.3.1
+## 3.3.1 - July 19, 2016
* Fixed a crash that occurred when a sprite URL lacks a file extension. See [this comment](https://github.com/mapbox/mapbox-gl-native/issues/5722#issuecomment-233701251) to determine who may be affected by this bug. ([#5723](https://github.com/mapbox/mapbox-gl-native/pull/5723))
* Fixed an issue causing overlapping polylines and polygons to be drawn in undefined z-order. Shapes are always drawn in the order they are added to the map, from the oldest on the bottom to the newest on the top. ([#5710](https://github.com/mapbox/mapbox-gl-native/pull/5710))
@@ -23,7 +35,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
* The compass, Mapbox logo, and attribution button now accommodate the containing map view’s content insets. If your interface elements partially overlap the map view but do not affect the top and bottom layout guides, set the `automaticallyAdjustsScrollViewInsets` property to `NO` and set the `contentInset` property to a suitable value. ([#5671](https://github.com/mapbox/mapbox-gl-native/pull/5671))
* Added a property to MGLOfflineStorage, `countOfBytesCompleted`, that indicates the disk space occupied by all cached and offline resources. ([#5585](https://github.com/mapbox/mapbox-gl-native/pull/5585))
-## 3.3.0
+## 3.3.0 - July 14, 2016
### Styles and data
@@ -78,25 +90,25 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Added NSFormatter subclasses for converting geographic coordinates and directions into display strings. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
- Added `MGLCoordinateInCoordinateBounds()`, a function that tests whether or not a coordinate is in a given bounds. ([#5053](https://github.com/mapbox/mapbox-gl-native/pull/5053))
-## 3.2.3
+## 3.2.3 - June 7, 2016
- Fixed an issue preventing `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` from being called when returning to the view controller containing the map view from another view controller. ([#5164](https://github.com/mapbox/mapbox-gl-native/pull/5164))
- Declarations in the API documentation are shown in both Objective-C and Swift. ([realm/jazzy#530](https://github.com/realm/jazzy/pull/530))
-## 3.2.2
+## 3.2.2 - May 10, 2016
- Existing MGLStyle class methods that return default style URLs have been deprecated in favor of new methods that require an explicit style version parameter. The deprecated, unversioned methods continue to return version 8 of the respective styles and will not be updated as new versions of the styles are released. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
- Deprecated `+[MGLStyle emeraldStyleURL]` with no replacement method. To use the Emerald style going forward, we recommend that you use the underlying URL. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
- Added `+[MGLStyle outdoorsStyleURLWithVersion:]` for the new Outdoors style. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
- The Hybrid style is now called Satellite Streets. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
-## 3.2.1
+## 3.2.1 - April 20, 2016
- Fixed a hang that could occur if the host application attempts to set user defaults on a background queue. ([#4745](https://github.com/mapbox/mapbox-gl-native/pull/4745))
- User location heading updates now resume properly when an app becomes active again. ([#4674](https://github.com/mapbox/mapbox-gl-native/pull/4674))
- Fixed an issue causing hyperlinks in the documentation to be displayed as raw Markdown syntax when viewed in Xcode’s Quick Help popover or sidebar. ([#4760](https://github.com/mapbox/mapbox-gl-native/pull/4760))
-## 3.2.0
+## 3.2.0 - April 5, 2016
- If you’ve previously installed the SDK as a static framework, the installation workflow has changed to address issues when submitting your application to the App Store or installing it on a device. Upon upgrading to this version of the SDK, you’ll need to add Mapbox.bundle to the Copy Bundle Resources build phase and remove Mapbox.framework from the Embed Frameworks build phase. ([#4455](https://github.com/mapbox/mapbox-gl-native/pull/4455))
- Offline packs can now be downloaded to allow users to view specific regions of the map offline. A new MGLOfflineStorage class provides APIs for managing MGLOfflinePacks. ([#4221](https://github.com/mapbox/mapbox-gl-native/pull/4221))
@@ -117,12 +129,12 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- The Improve This Map tool now uses the same zoom level that is currently being shown in the map view. ([#4068](https://github.com/mapbox/mapbox-gl-native/pull/4068))
- Fixed a formatting issue in the documentation for `MGLCoordinateBoundsIsEmpty()`. ([#3958](https://github.com/mapbox/mapbox-gl-native/pull/3958))
-## 3.1.2
+## 3.1.2 - February 22, 2016
- You can once again install the static framework without manually linking several framework and library dependencies. ([#4029](https://github.com/mapbox/mapbox-gl-native/pull/4029))
- The location manager used by MGLMapView to show the user’s location is now paused when the application is sent to the background. ([#4034](https://github.com/mapbox/mapbox-gl-native/pull/4034))
-## 3.1.1
+## 3.1.1 - February 15, 2016
- Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872))
- Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847))
@@ -131,7 +143,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Fixed an issue that incorrectly expanded the tappable area of an annotation and prevented the annotation’s alignment rect insets from having any effect on the tappable area. ([#3898](https://github.com/mapbox/mapbox-gl-native/pull/3898))
- Fixed an issue preventing `-[MGLMapViewDelegate mapView:tapOnCalloutForAnnotation:]` from being called when a non-custom callout view is tapped. ([#3875](https://github.com/mapbox/mapbox-gl-native/pull/3875))
-## 3.1.0
+## 3.1.0 - February 5, 2016
- The SDK is now distributed as a dynamic framework instead of a static library, resulting in a simpler installation workflow and significantly reduced download size. The framework contains both simulator and device content. If you install the dynamic framework manually, you’ll need to strip out the simulator content before submitting your application to the App Store due to [an Xcode bug](http://www.openradar.me/radar?id=6409498411401216); see the installation instructions included with the framework for details. ([#3183](https://github.com/mapbox/mapbox-gl-native/pull/3183))
- Fixed an issue causing the entire MGLMapView to leak. ([#3448](https://github.com/mapbox/mapbox-gl-native/pull/3448))
@@ -160,13 +172,13 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Avoids triggering the blue background location status bar when user has granted "when in use" permission. ([#3671](https://github.com/mapbox/mapbox-gl-native/issues/3671))
- Deprecated the `debugActive` property and `-toggleDebug` method on MGLMapView in favor of a new `debugMask` property that exposes individual style debugging options. ([#3742](https://github.com/mapbox/mapbox-gl-native/pull/3742))
-## 3.0.1
+## 3.0.1 - December 7, 2015
- Fixed CoreTelephony.framework crash. ([#3170](https://github.com/mapbox/mapbox-gl-native/pull/3170))
- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3117](https://github.com/mapbox/mapbox-gl-native/pull/3117))
- CocoaPods is now distributed via a (static) framework. ([#3181](https://github.com/mapbox/mapbox-gl-native/issues/3181))
-## 3.0.0
+## 3.0.0 - November 23, 2015
- If you install this SDK via CocoaPods, CocoaPods version 0.38.0 or above is required. ([#2132](https://github.com/mapbox/mapbox-gl-native/pull/2132))
- The `styleID` property has been removed from MGLMapView. Instead, set the `styleURL` property to an NSURL in the form `mapbox://styles/STYLE_ID`. If you previously set the style ID in Interface Builder’s Attributes inspector, delete the `styleID` entry from the User Defined Runtime Attributes section of the Identity inspector, then set the new “Style URL” inspectable to a value in the form `mapbox://styles/STYLE_ID`. ([#2632](https://github.com/mapbox/mapbox-gl-native/pull/2632))
@@ -191,15 +203,15 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Removed CoreTelephony.framework dependency. ([#2581](https://github.com/mapbox/mapbox-gl-native/pull/2581))
- Improved user location annotation responsiveness. ([#2643](https://github.com/mapbox/mapbox-gl-native/pull/2643))
-## 2.1.2
+## 2.1.2 - September 15, 2015
- Built with Xcode 6.4 to not yet trigger Bitcode compatibility until Xcode 7 stabilizes. ([#2332](https://github.com/mapbox/mapbox-gl-native/issues/2332))
-## 2.1.1
+## 2.1.1 - September 15, 2015
- Fixes for Xcode 7 and Bitcode. ([#2238](https://github.com/mapbox/mapbox-gl-native/pull/2238))
-## 2.1.0
+## 2.1.0 - September 14, 2015
- A two-finger vertical swipe now tilts the map into perspective mode. ([#2116](https://github.com/mapbox/mapbox-gl-native/pull/2116))
- A new `MGLMapCamera` API allows you to transition multiple viewpoint properties, including rotation and pitch, simultaneously with an optional custom duration and timing function. ([#2193](https://github.com/mapbox/mapbox-gl-native/pull/2193))
@@ -218,21 +230,21 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Minor style updates. ([#1910](https://github.com/mapbox/mapbox-gl-native/pull/1910))
- The CocoaPods pod now contains a `README.md` file. ([#1886](https://github.com/mapbox/mapbox-gl-native/pull/1886))
-## 2.0.0
+## 2.0.0 - August 21, 2015
Repackaging 2.0.0-pre.1 as it contained no issues.
-## 2.0.0-pre.1
+## 2.0.0-pre.1 - August 21, 2015
Repackaging 0.5.1 as the Mapbox iOS SDK 2.0.0 series.
-## 0.5.1
+## 0.5.1 - July 13, 2015
### iOS
- Added support for CocoaPods 0.38.0. ([#1876](https://github.com/mapbox/mapbox-gl-native/pull/1876))
-## 0.5.0
+## 0.5.0 - July 9, 2015
### Core
@@ -261,7 +273,7 @@ Repackaging 0.5.1 as the Mapbox iOS SDK 2.0.0 series.
- Fixed an issue in which `-[MGLMapView direction]` would sometimes return 360 instead of 0. ([#1829](https://github.com/mapbox/mapbox-gl-native/pull/1829))
- Build against iOS 8.4. ([#1868](https://github.com/mapbox/mapbox-gl-native/pull/1868))
-## 0.4.0
+## 0.4.0 - June 19, 2015
### Core
@@ -285,11 +297,11 @@ Repackaging 0.5.1 as the Mapbox iOS SDK 2.0.0 series.
- Internal use of the Reachability library has been cleaned up so that your app can include its own copy of Reachability. ([#1718](https://github.com/mapbox/mapbox-gl-native/issues/1718))
- Now distribute a binary stripped of debugging symbols by default with an optional, secondary symbols build. ([#1650](https://github.com/mapbox/mapbox-gl-native/issues/1650))
-## 0.3.1
+## 0.3.1 - May 15, 2015
- Temporarily removed `IBDesignable` support on iOS.
-## 0.3.0
+## 0.3.0 - May 14, 2015
- Initial iOS beta release.
diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md
index 4efc6af480..d78518eddd 100644
--- a/platform/ios/DEVELOPING.md
+++ b/platform/ios/DEVELOPING.md
@@ -63,6 +63,21 @@ The products of these build commands can be found in the `build/ios/pkg` folder
## Contributing
+### Making any symbol public
+
+To add any Objective-C type, constant, or member to the iOS SDK’s public interface:
+
+1. Ensure that the symbol is pure Objective-C and does not rely on any language features specific to Objective-C++ or the C11 dialect of C – so no namespaced types or classes named with emoji! 🙃 Most projects that depend on this SDK are either written in pure Objective-C (GNU99 dialect) or Swift, which cannot yet bridge C++ types.
+1. Name the symbol according to [Cocoa naming conventions](https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html#//apple_ref/doc/uid/10000146i). Use the `MGL` class prefix to avoid conflicts with client code. If the symbol has an analogue in MapKit, name the symbol according to MapKit.
+1. Provide full documentation comments. We use [jazzy](https://github.com/realm/jazzy/) to produce the documentation found in the SDK distribution and [on the Mapbox iOS SDK website](https://www.mapbox.com/ios-sdk/api/). We also recognize that many developers rely on Xcode’s Quick Help feature. jazzy supports Markdown formatting; however, Quick Help supports only [HeaderDoc](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html) syntax and a subset of Doxygen syntax. For hyperlinks, use HTML syntax, which is recognized by both tools.
+
+### Making a type or constant public
+
+To add an Objective-C class, protocol, category, typedef, enumeration, or global constant to the iOS SDK’s public interface:
+
+1. _(Optional.)_ Add the type or constant’s name to the relevant category in the `custom_categories` section of [the jazzy configuration file](./jazzy.yml). This is required for classes and protocols and also recommended for any other type that is strongly associated with a particular class or protocol. If you leave out this step, the symbol will appear in an “Other” section in the generated HTML documentation’s table of contents.
+1. _(Optional.)_ If the symbol would also be publicly exposed in the macOS SDK, consult [the companion macOS document](../macos/DEVELOPING.md#making-a-type-or-constant-public) for further instructions.
+
### Adding a source code file
To add an Objective-C header or implementation file to the iOS SDK:
diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift
index b1b11e5e34..1f368be73b 100644
--- a/platform/ios/Mapbox.playground/Contents.swift
+++ b/platform/ios/Mapbox.playground/Contents.swift
@@ -1,5 +1,9 @@
import UIKit
-import XCPlayground
+#if swift(>=3)
+ import PlaygroundSupport
+#else
+ import XCPlayground
+#endif
import Mapbox
let width: CGFloat = 700
@@ -9,7 +13,11 @@ class Responder: NSObject {
var mapView: MGLMapView?
func togglePitch(sender: UISwitch) {
let camera = mapView!.camera
- camera.pitch = sender.on ? 60 : 0
+ #if swift(>=3)
+ camera.pitch = sender.isOn ? 60 : 0
+ #else
+ camera.pitch = sender.on ? 60 : 0
+ #endif
mapView!.setCamera(camera, animated: false)
}
}
@@ -18,7 +26,11 @@ class Responder: NSObject {
let panelWidth: CGFloat = 200
let panel = UIView(frame: CGRect(x: width - panelWidth, y: 0, width: 200, height: 100))
panel.alpha = 0.8
-panel.backgroundColor = UIColor.whiteColor()
+#if swift(>=3)
+ panel.backgroundColor = .white
+#else
+ panel.backgroundColor = UIColor.whiteColor()
+#endif
// Delete markers
let deleteSwitchLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30))
@@ -41,7 +53,11 @@ let pitchLabel = UILabel(frame: CGRect(x: 0, y: 60, width: 100, height: 30))
pitchLabel.text = "Pitch"
let pitchSwitch = UISwitch(frame: CGRect(x: panelWidth-panelWidth / 2.0, y: 60, width: 100, height: 50))
let responder = Responder()
-pitchSwitch.addTarget(responder, action: #selector(responder.togglePitch(_:)), forControlEvents: .ValueChanged)
+#if swift(>=3)
+ pitchSwitch.addTarget(responder, action: #selector(responder.togglePitch(sender:)), for: .valueChanged)
+#else
+ pitchSwitch.addTarget(responder, action: #selector(responder.togglePitch(_:)), forControlEvents: .ValueChanged)
+#endif
panel.addSubview(pitchLabel)
panel.addSubview(pitchSwitch)
@@ -56,7 +72,11 @@ MGLAccountManager.setAccessToken(accessToken)
class PlaygroundAnnotationView: MGLAnnotationView {
override func prepareForReuse() {
- hidden = hideMarkerSwitchView.on
+ #if swift(>=3)
+ isHidden = hideMarkerSwitchView.isOn
+ #else
+ hidden = hideMarkerSwitchView.on
+ #endif
}
}
@@ -67,6 +87,29 @@ class MapDelegate: NSObject, MGLMapViewDelegate {
var annotationViewByAnnotation = [MGLPointAnnotation: PlaygroundAnnotationView]()
+ #if swift(>=3)
+ func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
+
+ var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "annotation") as? PlaygroundAnnotationView
+
+ if (annotationView == nil) {
+ let av = PlaygroundAnnotationView(reuseIdentifier: "annotation")
+ av.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
+ av.centerOffset = CGVector(dx: -15, dy: -15)
+ let centerView = UIView(frame: av.bounds.insetBy(dx: 3, dy: 3))
+ centerView.backgroundColor = .white
+ av.addSubview(centerView)
+ av.backgroundColor = .purple
+ annotationView = av
+ } else {
+ annotationView!.subviews.first?.backgroundColor = .green
+ }
+
+ annotationViewByAnnotation[annotation as! MGLPointAnnotation] = annotationView
+
+ return annotationView
+ }
+ #else
func mapView(mapView: MGLMapView, viewForAnnotation annotation: MGLAnnotation) -> MGLAnnotationView? {
var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier("annotation") as? PlaygroundAnnotationView
@@ -83,12 +126,40 @@ class MapDelegate: NSObject, MGLMapViewDelegate {
} else {
annotationView!.subviews.first?.backgroundColor = UIColor.greenColor()
}
-
+
annotationViewByAnnotation[annotation as! MGLPointAnnotation] = annotationView
return annotationView
}
+ #endif
+ #if swift(>=3)
+ func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {
+ let pointAnnotation = annotation as! MGLPointAnnotation
+ let annotationView: PlaygroundAnnotationView = annotationViewByAnnotation[pointAnnotation]!
+
+ for view in annotationViewByAnnotation.values {
+ view.layer.zPosition = -1
+ }
+
+ annotationView.layer.zPosition = 1
+
+ UIView.animate(withDuration: 1.25, delay: 0, usingSpringWithDamping: 0.4, initialSpringVelocity: 0.6, options: .curveEaseOut, animations: {
+ annotationView.transform = CGAffineTransform(scaleX: 1.8, y: 1.8)
+ }) { _ in
+ annotationView.transform = CGAffineTransform(scaleX: 1, y: 1)
+
+ if deleteMarkerSwitchView.isOn {
+ mapView.removeAnnotation(pointAnnotation)
+ return
+ }
+
+ if hideMarkerSwitchView.isOn {
+ annotationView.isHidden = true
+ }
+ }
+ }
+ #else
func mapView(mapView: MGLMapView, didSelectAnnotation annotation: MGLAnnotation) {
let pointAnnotation = annotation as! MGLPointAnnotation
let annotationView: PlaygroundAnnotationView = annotationViewByAnnotation[pointAnnotation]!
@@ -114,15 +185,25 @@ class MapDelegate: NSObject, MGLMapViewDelegate {
}
}
}
+ #endif
func handleTap(press: UILongPressGestureRecognizer) {
let mapView: MGLMapView = press.view as! MGLMapView
- if (press.state == .Recognized) {
- let coordiante: CLLocationCoordinate2D = mapView.convertPoint(press.locationInView(mapView), toCoordinateFromView: mapView)
+ #if swift(>=3)
+ let isRecognized = press.state == .recognized
+ #else
+ let isRecognized = press.state == .Recognized
+ #endif
+ if (isRecognized) {
+ #if swift(>=3)
+ let coordinate: CLLocationCoordinate2D = mapView.convert(press.location(in: mapView), toCoordinateFrom: mapView)
+ #else
+ let coordinate: CLLocationCoordinate2D = mapView.convertPoint(press.locationInView(mapView), toCoordinateFromView: mapView)
+ #endif
let annotation = MGLPointAnnotation()
annotation.title = "Dropped Marker"
- annotation.coordinate = coordiante
+ annotation.coordinate = coordinate
mapView.addAnnotation(annotation)
mapView.showAnnotations([annotation], animated: true)
}
@@ -132,14 +213,16 @@ class MapDelegate: NSObject, MGLMapViewDelegate {
//: Create a map and its delegate
-let lat: CLLocationDegrees = 37.174057
-let lng: CLLocationDegrees = -104.490984
-let centerCoordinate = CLLocationCoordinate2D(latitude: lat, longitude: lng)
+let centerCoordinate = CLLocationCoordinate2D(latitude: 37.174057, longitude: -104.490984)
let mapView = MGLMapView(frame: CGRect(x: 0, y: 0, width: width, height: height))
mapView.frame = CGRect(x: 0, y: 0, width: width, height: height)
-XCPlaygroundPage.currentPage.liveView = mapView
+#if swift(>=3)
+ PlaygroundPage.current.liveView = mapView
+#else
+ XCPlaygroundPage.currentPage.liveView = mapView
+#endif
let mapDelegate = MapDelegate()
mapView.delegate = mapDelegate
@@ -150,7 +233,11 @@ mapView.addGestureRecognizer(tapGesture)
//: Zoom in to a location
-mapView.setCenterCoordinate(centerCoordinate, zoomLevel: 12, animated: false)
+#if swift(>=3)
+ mapView.setCenter(centerCoordinate, zoomLevel: 12, animated: false)
+#else
+ mapView.setCenterCoordinate(centerCoordinate, zoomLevel: 12, animated: false)
+#endif
//: Add control panel
diff --git a/platform/ios/app/MBXAppDelegate.h b/platform/ios/app/MBXAppDelegate.h
index 8145d3b8ca..7ff321b6c7 100644
--- a/platform/ios/app/MBXAppDelegate.h
+++ b/platform/ios/app/MBXAppDelegate.h
@@ -6,4 +6,4 @@ extern NSString * const MBXMapboxAccessTokenDefaultsKey;
@property (strong, nonatomic) UIWindow *window;
-@end \ No newline at end of file
+@end
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 789ee00372..ef91c847be 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -30,6 +30,12 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
@implementation MBXCustomCalloutAnnotation
@end
+@interface MBXSpriteBackedAnnotation : MGLPointAnnotation
+@end
+
+@implementation MBXSpriteBackedAnnotation
+@end
+
@interface MBXViewController () <UIActionSheetDelegate, MGLMapViewDelegate>
@property (nonatomic) IBOutlet MGLMapView *mapView;
@@ -184,9 +190,12 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
((debugMask & MGLMapDebugOverdrawVisualizationMask)
? @"Hide Overdraw Visualization"
: @"Show Overdraw Visualization"),
- @"Add 100 Points",
- @"Add 1,000 Points",
- @"Add 10,000 Points",
+ @"Add 100 Views",
+ @"Add 1,000 Views",
+ @"Add 10,000 Views",
+ @"Add 100 Sprites",
+ @"Add 1,000 Sprites",
+ @"Add 10,000 Sprites",
@"Add Test Shapes",
@"Start World Tour",
@"Add Custom Callout Point",
@@ -230,109 +239,42 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 6)
{
- [self parseFeaturesAddingCount:100];
+ [self parseFeaturesAddingCount:100 usingViews:YES];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 7)
{
- [self parseFeaturesAddingCount:1000];
+ [self parseFeaturesAddingCount:1000 usingViews:YES];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 8)
{
- [self parseFeaturesAddingCount:10000];
+ [self parseFeaturesAddingCount:10000 usingViews:YES];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 9)
{
- // PNW triangle
- //
- CLLocationCoordinate2D triangleCoordinates[3] =
- {
- CLLocationCoordinate2DMake(44, -122),
- CLLocationCoordinate2DMake(46, -122),
- CLLocationCoordinate2DMake(46, -121)
- };
-
- MGLPolygon *triangle = [MGLPolygon polygonWithCoordinates:triangleCoordinates count:3];
-
- [self.mapView addAnnotation:triangle];
-
- // Orcas Island hike
- //
- NSDictionary *hike = [NSJSONSerialization JSONObjectWithData:
- [NSData dataWithContentsOfFile:
- [[NSBundle mainBundle] pathForResource:@"polyline" ofType:@"geojson"]]
- options:0
- error:nil];
-
- NSArray *hikeCoordinatePairs = hike[@"features"][0][@"geometry"][@"coordinates"];
-
- CLLocationCoordinate2D *polylineCoordinates = (CLLocationCoordinate2D *)malloc([hikeCoordinatePairs count] * sizeof(CLLocationCoordinate2D));
-
- for (NSUInteger i = 0; i < [hikeCoordinatePairs count]; i++)
- {
- polylineCoordinates[i] = CLLocationCoordinate2DMake([hikeCoordinatePairs[i][1] doubleValue], [hikeCoordinatePairs[i][0] doubleValue]);
- }
-
- MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:polylineCoordinates
- count:[hikeCoordinatePairs count]];
-
- [self.mapView addAnnotation:polyline];
-
- free(polylineCoordinates);
-
- // PA/NJ/DE polys
- //
- NSDictionary *threestates = [NSJSONSerialization JSONObjectWithData:
- [NSData dataWithContentsOfFile:
- [[NSBundle mainBundle] pathForResource:@"threestates" ofType:@"geojson"]]
- options:0
- error:nil];
-
- for (NSDictionary *feature in threestates[@"features"])
- {
- NSArray *stateCoordinatePairs = feature[@"geometry"][@"coordinates"];
-
- while ([stateCoordinatePairs count] == 1) stateCoordinatePairs = stateCoordinatePairs[0];
-
- CLLocationCoordinate2D *polygonCoordinates = (CLLocationCoordinate2D *)malloc([stateCoordinatePairs count] * sizeof(CLLocationCoordinate2D));
-
- for (NSUInteger i = 0; i < [stateCoordinatePairs count]; i++)
- {
- polygonCoordinates[i] = CLLocationCoordinate2DMake([stateCoordinatePairs[i][1] doubleValue], [stateCoordinatePairs[i][0] doubleValue]);
- }
-
- MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:polygonCoordinates count:[stateCoordinatePairs count]];
-
- [self.mapView addAnnotation:polygon];
-
- free(polygonCoordinates);
- }
-
- CLLocationCoordinate2D innerCoordinates[] = {
- CLLocationCoordinate2DMake(-5, -5),
- CLLocationCoordinate2DMake(-5, 5),
- CLLocationCoordinate2DMake(5, 5),
- CLLocationCoordinate2DMake(5, -5),
- };
- MGLPolygon *innerPolygon = [MGLPolygon polygonWithCoordinates:innerCoordinates count:sizeof(innerCoordinates) / sizeof(innerCoordinates[0])];
- CLLocationCoordinate2D outerCoordinates[] = {
- CLLocationCoordinate2DMake(-10, -20),
- CLLocationCoordinate2DMake(-10, 10),
- CLLocationCoordinate2DMake(10, 10),
- CLLocationCoordinate2DMake(10, -10),
- };
- MGLPolygon *outerPolygon = [MGLPolygon polygonWithCoordinates:outerCoordinates count:sizeof(outerCoordinates) / sizeof(outerCoordinates[0]) interiorPolygons:@[innerPolygon]];
- [self.mapView addAnnotation:outerPolygon];
+ [self parseFeaturesAddingCount:100 usingViews:NO];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 10)
{
- [self startWorldTour:actionSheet];
+ [self parseFeaturesAddingCount:1000 usingViews:NO];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 11)
{
- [self presentAnnotationWithCustomCallout];
+ [self parseFeaturesAddingCount:10000 usingViews:NO];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 12)
{
+ [self addTestShapes];
+ }
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 13)
+ {
+ [self startWorldTour:actionSheet];
+ }
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14)
+ {
+ [self presentAnnotationWithCustomCallout];
+ }
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 15)
+ {
[self.mapView removeAnnotations:self.mapView.annotations];
}
else if (buttonIndex == actionSheet.numberOfButtons - 2 && self.debugLoggingEnabled)
@@ -355,7 +297,7 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
}
}
-- (void)parseFeaturesAddingCount:(NSUInteger)featuresCount
+- (void)parseFeaturesAddingCount:(NSUInteger)featuresCount usingViews:(BOOL)useViews
{
[self.mapView removeAnnotations:self.mapView.annotations];
@@ -377,7 +319,8 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
[feature[@"geometry"][@"coordinates"][0] doubleValue]);
NSString *title = feature[@"properties"][@"NAME"];
- MGLPointAnnotation *annotation = [MGLPointAnnotation new];
+ MGLPointAnnotation *annotation = (useViews ? [MGLPointAnnotation new] : [MBXSpriteBackedAnnotation new]);
+
annotation.coordinate = coordinate;
annotation.title = title;
@@ -395,6 +338,92 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
});
}
+- (void)addTestShapes
+{
+ // Pacific Northwest triangle
+ //
+ CLLocationCoordinate2D triangleCoordinates[3] =
+ {
+ CLLocationCoordinate2DMake(44, -122),
+ CLLocationCoordinate2DMake(46, -122),
+ CLLocationCoordinate2DMake(46, -121)
+ };
+
+ MGLPolygon *triangle = [MGLPolygon polygonWithCoordinates:triangleCoordinates count:3];
+
+ [self.mapView addAnnotation:triangle];
+
+ // Orcas Island, WA hike polyline
+ //
+ NSDictionary *hike = [NSJSONSerialization JSONObjectWithData:
+ [NSData dataWithContentsOfFile:
+ [[NSBundle mainBundle] pathForResource:@"polyline" ofType:@"geojson"]]
+ options:0
+ error:nil];
+
+ NSArray *hikeCoordinatePairs = hike[@"features"][0][@"geometry"][@"coordinates"];
+
+ CLLocationCoordinate2D *polylineCoordinates = (CLLocationCoordinate2D *)malloc([hikeCoordinatePairs count] * sizeof(CLLocationCoordinate2D));
+
+ for (NSUInteger i = 0; i < [hikeCoordinatePairs count]; i++)
+ {
+ polylineCoordinates[i] = CLLocationCoordinate2DMake([hikeCoordinatePairs[i][1] doubleValue], [hikeCoordinatePairs[i][0] doubleValue]);
+ }
+
+ MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:polylineCoordinates
+ count:[hikeCoordinatePairs count]];
+
+ [self.mapView addAnnotation:polyline];
+
+ free(polylineCoordinates);
+
+ // PA/NJ/DE polygons
+ //
+ NSDictionary *threestates = [NSJSONSerialization JSONObjectWithData:
+ [NSData dataWithContentsOfFile:
+ [[NSBundle mainBundle] pathForResource:@"threestates" ofType:@"geojson"]]
+ options:0
+ error:nil];
+
+ for (NSDictionary *feature in threestates[@"features"])
+ {
+ NSArray *stateCoordinatePairs = feature[@"geometry"][@"coordinates"];
+
+ while ([stateCoordinatePairs count] == 1) stateCoordinatePairs = stateCoordinatePairs[0];
+
+ CLLocationCoordinate2D *polygonCoordinates = (CLLocationCoordinate2D *)malloc([stateCoordinatePairs count] * sizeof(CLLocationCoordinate2D));
+
+ for (NSUInteger i = 0; i < [stateCoordinatePairs count]; i++)
+ {
+ polygonCoordinates[i] = CLLocationCoordinate2DMake([stateCoordinatePairs[i][1] doubleValue], [stateCoordinatePairs[i][0] doubleValue]);
+ }
+
+ MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:polygonCoordinates count:[stateCoordinatePairs count]];
+
+ [self.mapView addAnnotation:polygon];
+
+ free(polygonCoordinates);
+ }
+
+ // Null Island polygon with an interior hole
+ //
+ CLLocationCoordinate2D innerCoordinates[] = {
+ CLLocationCoordinate2DMake(-5, -5),
+ CLLocationCoordinate2DMake(-5, 5),
+ CLLocationCoordinate2DMake(5, 5),
+ CLLocationCoordinate2DMake(5, -5),
+ };
+ MGLPolygon *innerPolygon = [MGLPolygon polygonWithCoordinates:innerCoordinates count:sizeof(innerCoordinates) / sizeof(innerCoordinates[0])];
+ CLLocationCoordinate2D outerCoordinates[] = {
+ CLLocationCoordinate2DMake(-10, -10),
+ CLLocationCoordinate2DMake(-10, 10),
+ CLLocationCoordinate2DMake(10, 10),
+ CLLocationCoordinate2DMake(10, -10),
+ };
+ MGLPolygon *outerPolygon = [MGLPolygon polygonWithCoordinates:outerCoordinates count:sizeof(outerCoordinates) / sizeof(outerCoordinates[0]) interiorPolygons:@[innerPolygon]];
+ [self.mapView addAnnotation:outerPolygon];
+}
+
- (void)presentAnnotationWithCustomCallout
{
[self.mapView removeAnnotations:self.mapView.annotations];
@@ -575,7 +604,7 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
- (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation
{
// Use GL backed pins for dropped pin annotations
- if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]])
+ if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]] || [annotation isKindOfClass:[MBXSpriteBackedAnnotation class]])
{
return nil;
}
@@ -603,6 +632,73 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
return annotationView;
}
+- (MGLAnnotationImage *)mapView:(MGLMapView * __nonnull)mapView imageForAnnotation:(id <MGLAnnotation> __nonnull)annotation
+{
+ if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]] || [annotation isKindOfClass:[MBXCustomCalloutAnnotation class]])
+ {
+ return nil; // use default marker
+ }
+
+ NSAssert([annotation isKindOfClass:[MBXSpriteBackedAnnotation class]], @"Annotations should be sprite-backed.");
+
+ NSString *title = [(MGLPointAnnotation *)annotation title];
+ if (!title.length) return nil;
+ NSString *lastTwoCharacters = [title substringFromIndex:title.length - 2];
+
+ MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:lastTwoCharacters];
+
+ if ( ! annotationImage)
+ {
+ UIColor *color;
+
+ // make every tenth annotation blue
+ if ([lastTwoCharacters hasSuffix:@"0"]) {
+ color = [UIColor blueColor];
+ } else {
+ color = [UIColor redColor];
+ }
+
+ UIImage *image = [self imageWithText:lastTwoCharacters backgroundColor:color];
+ annotationImage = [MGLAnnotationImage annotationImageWithImage:image reuseIdentifier:lastTwoCharacters];
+
+ // don't allow touches on blue annotations
+ if ([color isEqual:[UIColor blueColor]]) annotationImage.enabled = NO;
+ }
+
+ return annotationImage;
+}
+
+
+- (UIImage *)imageWithText:(NSString *)text backgroundColor:(UIColor *)color
+{
+ CGRect rect = CGRectMake(0, 0, 20, 15);
+
+ UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]);
+
+ CGContextRef ctx = UIGraphicsGetCurrentContext();
+
+ CGContextSetFillColorWithColor(ctx, [[color colorWithAlphaComponent:0.75] CGColor]);
+ CGContextFillRect(ctx, rect);
+
+ CGContextSetStrokeColorWithColor(ctx, [[UIColor blackColor] CGColor]);
+ CGContextStrokeRectWithWidth(ctx, rect, 2);
+
+ NSAttributedString *drawString = [[NSAttributedString alloc] initWithString:text attributes:@{
+ NSFontAttributeName: [UIFont fontWithName:@"Arial-BoldMT" size:12],
+ NSForegroundColorAttributeName: [UIColor whiteColor],
+ }];
+ CGSize stringSize = drawString.size;
+ CGRect stringRect = CGRectMake((rect.size.width - stringSize.width) / 2,
+ (rect.size.height - stringSize.height) / 2,
+ stringSize.width,
+ stringSize.height);
+ [drawString drawInRect:stringRect];
+
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+ return image;
+}
+
- (BOOL)mapView:(__unused MGLMapView *)mapView annotationCanShowCallout:(__unused id <MGLAnnotation>)annotation
{
return YES;
diff --git a/platform/ios/benchmark/MBXBenchAppDelegate.h b/platform/ios/benchmark/MBXBenchAppDelegate.h
index e89add93fd..6ae9cdf27c 100644
--- a/platform/ios/benchmark/MBXBenchAppDelegate.h
+++ b/platform/ios/benchmark/MBXBenchAppDelegate.h
@@ -6,4 +6,4 @@ extern NSString * const MBXMapboxAccessTokenDefaultsKey;
@property (strong, nonatomic) UIWindow *window;
-@end \ No newline at end of file
+@end
diff --git a/platform/ios/docs/doc-README.md b/platform/ios/docs/doc-README.md
index 057dbe719c..22493b1502 100644
--- a/platform/ios/docs/doc-README.md
+++ b/platform/ios/docs/doc-README.md
@@ -1,6 +1,6 @@
# [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)
-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 GL 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.
+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.
![Mapbox iOS SDK screenshots](screenshot.png)
diff --git a/platform/ios/docs/pod-README.md b/platform/ios/docs/pod-README.md
index 1633c7d126..93aa18bc65 100644
--- a/platform/ios/docs/pod-README.md
+++ b/platform/ios/docs/pod-README.md
@@ -1,6 +1,6 @@
# [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)
-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 GL 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.
+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.
For more information, check out the [Mapbox iOS SDK homepage](https://www.mapbox.com/ios-sdk/) and the [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) online.
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 83ae3e6406..bfd5a5e8a9 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -13,6 +13,8 @@
353794D01D22B3BD002C281C /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; settings = {ATTRIBUTES = (Private, ); }; };
353D23961D0B0DFE002BE09D /* MGLAnnotationViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 353D23951D0B0DFE002BE09D /* MGLAnnotationViewTests.m */; };
35E208A71D24210F00EC9A46 /* MGLNSDataAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */; };
+ 36F1153D1D46080700878E1A /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F1153B1D46080700878E1A /* libmbgl-core.a */; };
+ 36F1153E1D46080700878E1A /* libmbgl-platform-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */; };
4018B1C71CDC287F00F666AF /* MGLAnnotationView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */; };
4018B1C81CDC287F00F666AF /* MGLAnnotationView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */; };
4018B1C91CDC288A00F666AF /* MGLAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */; };
@@ -22,6 +24,7 @@
40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; };
40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; };
40FDA76B1CCAAA6800442548 /* MBXAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */; };
+ 554180421D2E97DE00012372 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 554180411D2E97DE00012372 /* OpenGLES.framework */; };
DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */; };
DA17BE301CC4BAC300402C41 /* MGLMapView_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */; };
DA17BE311CC4BDAA00402C41 /* MGLMapView_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */; };
@@ -335,6 +338,8 @@
35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+MGLAdditions.mm"; sourceTree = "<group>"; };
353D23951D0B0DFE002BE09D /* MGLAnnotationViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationViewTests.m; sourceTree = "<group>"; };
35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNSDataAdditionsTests.m; sourceTree = "<group>"; };
+ 36F1153B1D46080700878E1A /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-core.a"; path = "build/Debug-iphoneos/libmbgl-core.a"; sourceTree = "<group>"; };
+ 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-platform-ios.a"; path = "build/Debug-iphoneos/libmbgl-platform-ios.a"; sourceTree = "<group>"; };
4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView_Private.h; sourceTree = "<group>"; };
4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAnnotationView.mm; sourceTree = "<group>"; };
4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView.h; sourceTree = "<group>"; };
@@ -343,6 +348,7 @@
40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationContainerView.m; sourceTree = "<group>"; };
40FDA7691CCAAA6800442548 /* MBXAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXAnnotationView.h; sourceTree = "<group>"; };
40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXAnnotationView.m; sourceTree = "<group>"; };
+ 554180411D2E97DE00012372 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = "<group>"; };
DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView_Internal.h; sourceTree = "<group>"; };
DA1DC94A1CB6C1C2006E619F /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -516,6 +522,7 @@
buildActionMask = 2147483647;
files = (
DA8847D91CBAF91600AB86E3 /* Mapbox.framework in Frameworks */,
+ 554180421D2E97DE00012372 /* OpenGLES.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -543,6 +550,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 36F1153D1D46080700878E1A /* libmbgl-core.a in Frameworks */,
+ 36F1153E1D46080700878E1A /* libmbgl-platform-ios.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -631,6 +640,9 @@
DA1DC9921CB6DF24006E619F /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 36F1153B1D46080700878E1A /* libmbgl-core.a */,
+ 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */,
+ 554180411D2E97DE00012372 /* OpenGLES.framework */,
DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */,
DAABF73C1CBC59BB005B1825 /* libmbgl-platform-ios.a */,
DAA4E4021CBB5C2F00178DFB /* CoreGraphics.framework */,
@@ -1701,6 +1713,7 @@
"$(OTHER_CFLAGS)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1719,6 +1732,7 @@
"$(OTHER_CFLAGS)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1751,12 +1765,13 @@
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
OTHER_LDFLAGS = (
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
- "$(geojsonvt_static_libs)",
+ "$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
@@ -1792,12 +1807,13 @@
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
OTHER_LDFLAGS = (
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
- "$(geojsonvt_static_libs)",
+ "$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
@@ -1839,6 +1855,10 @@
../../include,
../../src,
);
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/build/Debug-iphoneos",
+ );
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"$(sqlite_cflags)",
@@ -1846,13 +1866,14 @@
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
OTHER_LDFLAGS = (
"-ObjC",
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
- "$(geojsonvt_static_libs)",
+ "$(geojson_static_libs)",
);
PRODUCT_NAME = Mapbox;
PUBLIC_HEADERS_FOLDER_PATH = Headers;
@@ -1870,6 +1891,10 @@
../../include,
../../src,
);
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/build/Debug-iphoneos",
+ );
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"$(sqlite_cflags)",
@@ -1877,13 +1902,14 @@
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
+ "$(geojson_cflags)",
);
OTHER_LDFLAGS = (
"-ObjC",
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
- "$(geojsonvt_static_libs)",
+ "$(geojson_static_libs)",
);
PRODUCT_NAME = Mapbox;
PUBLIC_HEADERS_FOLDER_PATH = Headers;
diff --git a/platform/ios/scripts/configure.sh b/platform/ios/scripts/configure.sh
index 408180881c..82599f0fe9 100644
--- a/platform/ios/scripts/configure.sh
+++ b/platform/ios/scripts/configure.sh
@@ -5,8 +5,11 @@ PROTOZERO_VERSION=1.3.0
BOOST_VERSION=1.60.0
SQLITE_VERSION=system
ZLIB_VERSION=system
-GEOMETRY_VERSION=0.5.0
-GEOJSONVT_VERSION=4.1.2
+GEOMETRY_VERSION=0.8.0
+GEOJSON_VERSION=0.1.4
+GEOJSONVT_VERSION=6.1.2
+SUPERCLUSTER_VERSION=0.2.0
+KDBUSH_VERSION=0.1.1
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0
diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh
index c753c63dfd..c012934203 100755
--- a/platform/ios/scripts/package.sh
+++ b/platform/ios/scripts/package.sh
@@ -108,7 +108,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
-jobs ${JOBS} | xcpretty
fi
-LIBS=(Mapbox.a mbgl-core.a mbgl-platform-ios.a)
+LIBS=(Mapbox.a)
# https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c
if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
@@ -119,7 +119,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphoneos/lib} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
- `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a`
+ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a`
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
@@ -129,9 +129,19 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
cp -r \
${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework \
${OUTPUT}/dynamic/
+
if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM ]]; then
+ step "Copying dSYM"
cp -r ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \
- ${OUTPUT}/dynamic/
+ ${OUTPUT}/dynamic/
+ if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then
+ step "Merging device and simulator dSYMs…"
+ lipo \
+ ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \
+ ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \
+ -create -output ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}
+ lipo -info ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}
+ fi
fi
step "Merging simulator dynamic library into device dynamic library…"
@@ -149,7 +159,7 @@ else
libtool -static -no_warning_for_no_symbols \
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
- `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a`
+ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a`
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
@@ -160,6 +170,7 @@ else
${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework \
${OUTPUT}/dynamic/${NAME}.framework
if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then
+ step "Copying dSYM"
cp -r ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \
${OUTPUT}/dynamic/
fi
diff --git a/platform/ios/src/MGLAnnotationImage.h b/platform/ios/src/MGLAnnotationImage.h
index fa2adb3830..5ded4016f7 100644
--- a/platform/ios/src/MGLAnnotationImage.h
+++ b/platform/ios/src/MGLAnnotationImage.h
@@ -4,7 +4,12 @@
NS_ASSUME_NONNULL_BEGIN
-/** The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view. */
+/**
+ The `MGLAnnotationImage` class is responsible for presenting point-based
+ annotations visually on a map view. Annotation image objects wrap `UIImage`
+ objects and may be recycled later and put into a reuse queue that is maintained
+ by the map view.
+ */
@interface MGLAnnotationImage : NSObject
#pragma mark Initializing and Preparing the Image Object
@@ -13,8 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
Initializes and returns a new annotation image object.
@param image The image to be displayed for the annotation.
- @param reuseIdentifier The string that identifies that this annotation image is reusable.
- @return The initialized annotation image object or `nil` if there was a problem initializing the object.
+ @param reuseIdentifier The string that identifies that this annotation image is
+ reusable.
+ @return The initialized annotation image object or `nil` if there was a problem
+ initializing the object.
*/
+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier;
@@ -26,16 +33,21 @@ NS_ASSUME_NONNULL_BEGIN
/**
The string that identifies that this annotation image is reusable. (read-only)
- You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen.
+ You specify the reuse identifier when you create the image object. You use this
+ type later to retrieve an annotation image object that was created previously
+ but which is currently unused because its annotation is not on screen.
- If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one.
+ If you define distinctly different types of annotations (with distinctly
+ different annotation images to go with them), you can differentiate between the
+ annotation types by specifying different reuse identifiers for each one.
*/
@property (nonatomic, readonly) NSString *reuseIdentifier;
/**
A Boolean value indicating whether the annotation is enabled.
- The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected.
+ The default value of this property is `YES`. If the value of this property is
+ `NO`, the annotation image ignores touch events and cannot be selected.
*/
@property (nonatomic, getter=isEnabled) BOOL enabled;
diff --git a/platform/ios/src/MGLCalloutView.h b/platform/ios/src/MGLCalloutView.h
index 641976dfee..27d173b230 100644
--- a/platform/ios/src/MGLCalloutView.h
+++ b/platform/ios/src/MGLCalloutView.h
@@ -8,32 +8,38 @@ NS_ASSUME_NONNULL_BEGIN
@protocol MGLAnnotation;
/**
- A protocol for a `UIView` subclass that displays information about a selected annotation near that annotation.
+ A protocol for a `UIView` subclass that displays information about a selected
+ annotation near that annotation.
*/
@protocol MGLCalloutView <NSObject>
/**
- An object conforming to the `MGLAnnotation` protocol whose details this callout view displays.
+ An object conforming to the `MGLAnnotation` protocol whose details this callout
+ view displays.
*/
@property (nonatomic, strong) id <MGLAnnotation> representedObject;
/**
- A view that the user may tap to perform an action. This view is conventionally positioned on the left side of the callout view.
+ A view that the user may tap to perform an action. This view is conventionally
+ positioned on the left side of the callout view.
*/
@property (nonatomic, strong) UIView *leftAccessoryView;
/**
- A view that the user may tap to perform an action. This view is conventionally positioned on the right side of the callout view.
+ A view that the user may tap to perform an action. This view is conventionally
+ positioned on the right side of the callout view.
*/
@property (nonatomic, strong) UIView *rightAccessoryView;
/**
- An object conforming to the `MGLCalloutViewDelegate` method that receives messages related to the callout view’s interactive subviews.
+ An object conforming to the `MGLCalloutViewDelegate` method that receives
+ messages related to the callout view’s interactive subviews.
*/
@property (nonatomic, weak) id<MGLCalloutViewDelegate> delegate;
/**
- Presents a callout view by adding it to `inView` and pointing at the given rect of `inView`’s bounds. Constrains the callout to the bounds of the given view.
+ Presents a callout view by adding it to `view` and pointing at the given rect
+ of `view`’s bounds. Constrains the callout to the bounds of the given view.
*/
- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated;
@@ -45,15 +51,21 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
- The MGLCalloutViewDelegate protocol defines a set of optional methods that you can use to receive messages from an object that conforms to the MGLCalloutView protocol. The callout view uses these methods to inform the delegate that the user has interacted with the the callout view.
+ The `MGLCalloutViewDelegate` protocol defines a set of optional methods that
+ you can use to receive messages from an object that conforms to the
+ `MGLCalloutView` protocol. The callout view uses these methods to inform the
+ delegate that the user has interacted with the the callout view.
*/
@protocol MGLCalloutViewDelegate <NSObject>
@optional
/**
- Returns a Boolean value indicating whether the entire callout view “highlights” when tapped. The default value is `YES`, which means the callout view highlights when tapped.
+ Returns a Boolean value indicating whether the entire callout view “highlights”
+ when tapped. The default value is `YES`, which means the callout view
+ highlights when tapped.
- The return value of this method is ignored unless the delegate also responds to the `-calloutViewTapped` method.
+ The return value of this method is ignored unless the delegate also responds to
+ the `-calloutViewTapped` method.
*/
- (BOOL)calloutViewShouldHighlight:(UIView<MGLCalloutView> *)calloutView;
@@ -63,12 +75,14 @@ NS_ASSUME_NONNULL_BEGIN
- (void)calloutViewTapped:(UIView<MGLCalloutView> *)calloutView;
/**
- Called before the callout view appears on screen, or before the appearance animation will start.
+ Called before the callout view appears on screen, or before the appearance
+ animation will start.
*/
- (void)calloutViewWillAppear:(UIView<MGLCalloutView> *)calloutView;
/**
- Called after the callout view appears on screen, or after the appearance animation is complete.
+ Called after the callout view appears on screen, or after the appearance
+ animation is complete.
*/
- (void)calloutViewDidAppear:(UIView<MGLCalloutView> *)calloutView;
diff --git a/platform/ios/src/MGLCompactCalloutView.h b/platform/ios/src/MGLCompactCalloutView.h
index ebe27c842c..56c48a99e5 100644
--- a/platform/ios/src/MGLCompactCalloutView.h
+++ b/platform/ios/src/MGLCompactCalloutView.h
@@ -2,7 +2,10 @@
#import "MGLCalloutView.h"
/**
- A concrete implementation of `MGLCalloutView` based on <a href="https://github.com/nfarina/calloutview">SMCalloutView</a>. This callout view displays the represented annotation’s title, subtitle, and accessory views in a compact, two-line layout.
+ A concrete implementation of `MGLCalloutView` based on
+ <a href="https://github.com/nfarina/calloutview">SMCalloutView</a>. This
+ callout view displays the represented annotation’s title, subtitle, and
+ accessory views in a compact, two-line layout.
*/
@interface MGLCompactCalloutView : SMCalloutView <MGLCalloutView>
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index a70b603f02..56236c54d8 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -43,7 +43,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
MGLAnnotationVerticalAlignmentBottom,
};
-/** Options for enabling debugging features in an MGLMapView instance. */
+/** Options for enabling debugging features in an `MGLMapView` instance. */
typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
tile clipping issues. */
@@ -57,13 +57,14 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
MGLMapDebugCollisionBoxesMask = 1 << 4,
/** Each drawing operation is replaced by a translucent fill. Overlapping
drawing operations appear more prominent to help diagnose overdrawing.
+ @note This option does nothing in Release builds of the SDK.
*/
MGLMapDebugOverdrawVisualizationMask = 1 << 5,
};
/**
An interactive, customizable map view with an interface similar to the one
- provided by Apple's MapKit.
+ provided by Apple’s MapKit.
Using `MGLMapView`, you can embed the map inside a view, allow users to
manipulate it with standard gestures, animate the map between different
@@ -72,7 +73,7 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
The map view loads scalable vector tiles that conform to the
<a href="https://github.com/mapbox/vector-tile-spec">Mapbox Vector Tile Specification</a>.
It styles them with a style that conforms to the
- <a href="https://www.mapbox.com/mapbox-gl-style-spec/">Mapbox GL style specification</a>.
+ <a href="https://www.mapbox.com/mapbox-gl-style-spec/">Mapbox Style Specification</a>.
Such styles can be designed in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a> and hosted on
mapbox.com.
@@ -86,7 +87,7 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
Mapbox-hosted vector tiles and styles require an API access token, which you
can obtain from the
<a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>.
- Access tokens associate requests to Mapbox's vector tile and style APIs with
+ Access tokens associate requests to Mapbox’s vector tile and style APIs with
your Mapbox account. They also deter other developers from using your styles
without your permission.
@@ -113,9 +114,9 @@ IB_DESIGNABLE
@param frame The frame for the view, measured in points.
@param styleURL URL of the map style to display. The URL may be a full HTTP
- or HTTPS URL, a Mapbox URL indicating the style's map ID
+ or HTTPS URL, a Mapbox URL indicating the style’s map ID
(`mapbox://styles/{user}/{style}`), or a path to a local file relative
- to the application's resource path. Specify `nil` for the default style.
+ to the application’s resource path. Specify `nil` for the default style.
@return An initialized map view.
*/
- (instancetype)initWithFrame:(CGRect)frame styleURL:(nullable NSURL *)styleURL;
@@ -123,7 +124,7 @@ IB_DESIGNABLE
#pragma mark Accessing the Delegate
/**
- The receiver's delegate.
+ The receiver’s delegate.
A map view sends messages to its delegate to notify it of changes to its
contents or the viewpoint. The delegate also provides information about
@@ -132,7 +133,7 @@ IB_DESIGNABLE
*/
@property(nonatomic, weak, nullable) IBOutlet id<MGLMapViewDelegate> delegate;
-#pragma mark Configuring the Map's Appearance
+#pragma mark Configuring the Map’s Appearance
/**
URLs of the styles bundled with the library.
@@ -145,12 +146,12 @@ IB_DESIGNABLE
/**
URL of the style currently displayed in the receiver.
- The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style's
+ The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s
map ID (`mapbox://styles/{user}/{style}`), or a path to a local file
- relative to the application's resource path.
+ relative to the application’s resource path.
If you set this property to `nil`, the receiver will use the default style
- and this property will automatically be set to that style's URL.
+ and this property will automatically be set to that style’s URL.
*/
@property (nonatomic, null_resettable) NSURL *styleURL;
@@ -169,7 +170,7 @@ IB_DESIGNABLE
- (IBAction)reloadStyle:(id)sender;
/**
- A control indicating the map's direction and allowing the user to manipulate
+ A control indicating the map’s direction and allowing the user to manipulate
the direction, positioned in the upper-right corner.
*/
@property (nonatomic, readonly) UIImageView *compassView;
@@ -235,18 +236,18 @@ IB_DESIGNABLE
*/
- (void)removeStyleClass:(NSString *)styleClass;
-#pragma mark Displaying the User's Location
+#pragma mark Displaying the User’s Location
/**
A Boolean value indicating whether the map may display the user location.
Setting this property to `YES` causes the map view to use the Core Location
framework to find the current location. As long as this property is `YES`, the
- map view continues to track the user's location and update it periodically.
+ map view continues to track the user’s location and update it periodically.
- This property does not indicate whether the user's position is actually visible
+ This property does not indicate whether the user’s position is actually visible
on the map, only whether the map view is allowed to display it. To determine
- whether the user's position is visible, use the `userLocationVisible` property.
+ whether the user’s position is visible, use the `userLocationVisible` property.
The default value of this property is `NO`.
On iOS 8 and above, your app must specify a value for
@@ -257,7 +258,7 @@ IB_DESIGNABLE
@property (nonatomic, assign) BOOL showsUserLocation;
/**
- A Boolean value indicating whether the device's current location is visible in
+ A Boolean value indicating whether the device’s current location is visible in
the map view.
Use `showsUserLocation` to control the visibility of the on-screen user
@@ -266,7 +267,7 @@ IB_DESIGNABLE
@property (nonatomic, assign, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
/**
- Returns the annotation object indicating the user's current location.
+ Returns the annotation object indicating the user’s current location.
*/
@property (nonatomic, readonly, nullable) MGLUserLocation *userLocation;
@@ -577,7 +578,7 @@ IB_DESIGNABLE
- (IBAction)resetNorth;
/**
- The coordinate bounds visible in the receiver's viewport.
+ The coordinate bounds visible in the receiver’s viewport.
Changing the value of this property updates the receiver immediately. If you
want to animate the change, call `-setVisibleCoordinateBounds:animated:`
@@ -596,7 +597,7 @@ IB_DESIGNABLE
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated;
/**
- Changes the receiver's viewport to fit the given coordinate bounds and
+ Changes the receiver’s viewport to fit the given coordinate bounds and
optionally some additional padding on each side.
@param bounds The bounds that the viewport will show in its entirety.
@@ -608,7 +609,7 @@ IB_DESIGNABLE
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/**
- Changes the receiver's viewport to fit all of the given coordinates and
+ Changes the receiver’s viewport to fit all of the given coordinates and
optionally some additional padding on each side.
@param coordinates The coordinates that the viewport will show.
@@ -622,7 +623,7 @@ IB_DESIGNABLE
- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/**
- Changes the receiver's viewport to fit all of the given coordinates and
+ Changes the receiver’s viewport to fit all of the given coordinates and
optionally some additional padding on each side.
@param coordinates The coordinates that the viewport will show.
@@ -656,7 +657,7 @@ IB_DESIGNABLE
Sets the visible region so that the map displays the specified annotations with
the specified amount of padding on each side.
- Calling this method updates the value in the visibleCoordinateBounds property
+ Calling this method updates the value in the `visibleCoordinateBounds` property
and potentially other properties to reflect the new map region.
@param annotations The annotations that you want to be visible in the map.
@@ -787,7 +788,7 @@ IB_DESIGNABLE
- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets;
/**
- Returns the point in this view's coordinate system on which to "anchor" in
+ Returns the point in this view’s coordinate system on which to "anchor" in
response to a user-initiated gesture.
For example, a pinch-to-zoom gesture would anchor the map at the midpoint of
@@ -797,7 +798,7 @@ IB_DESIGNABLE
user annotation is used as the anchor point.
Subclasses may override this method to provide specialized behavior - for
- example, anchoring on the map's center point to provide a "locked" zooming
+ example, anchoring on the map’s center point to provide a "locked" zooming
mode.
@param gesture An anchorable user gesture.
@@ -849,7 +850,7 @@ IB_DESIGNABLE
#pragma mark Converting Geographic Coordinates
/**
- Converts a point in the given view's coordinate system to a geographic
+ Converts a point in the given view’s coordinate system to a geographic
coordinate.
@param point The point to convert.
@@ -859,13 +860,13 @@ IB_DESIGNABLE
- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(nullable UIView *)view;
/**
- Converts a geographic coordinate to a point in the given view's coordinate
+ Converts a geographic coordinate to a point in the given view’s coordinate
system.
@param coordinate The geographic coordinate to convert.
@param view The view in whose coordinate system the returned point should be
expressed. If this parameter is `nil`, the returned point is expressed
- in the window's coordinate system. If `view` is not `nil`, it must
+ in the window’s coordinate system. If `view` is not `nil`, it must
belong to the same window as the map view.
@return The point (in the appropriate view or window coordinate system)
corresponding to the given geographic coordinate.
@@ -895,7 +896,7 @@ IB_DESIGNABLE
- (CGRect)convertCoordinateBounds:(MGLCoordinateBounds)bounds toRectToView:(nullable UIView *)view;
/**
- Returns the distance spanned by one point in the map view's coordinate system
+ Returns the distance spanned by one point in the map view’s coordinate system
at the given latitude and current zoom level.
The distance between points decreases as the latitude approaches the poles.
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 4ec3619189..b0c213ebfb 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -134,11 +134,11 @@ mbgl::Color MGLColorObjectFromUIColor(UIColor *color)
{
if (!color)
{
- return {{ 0, 0, 0, 0 }};
+ return { 0, 0, 0, 0 };
}
CGFloat r, g, b, a;
[color getRed:&r green:&g blue:&b alpha:&a];
- return {{ (float)r, (float)g, (float)b, (float)a }};
+ return { (float)r, (float)g, (float)b, (float)a };
}
@interface MGLAnnotationAccessibilityElement : UIAccessibilityElement
@@ -1815,7 +1815,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
mask |= MGLMapDebugCollisionBoxesMask;
}
- if (options & mbgl::MapDebugOptions::Wireframe)
+ if (options & mbgl::MapDebugOptions::Overdraw)
{
mask |= MGLMapDebugOverdrawVisualizationMask;
}
@@ -1843,7 +1843,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
}
if (debugMask & MGLMapDebugOverdrawVisualizationMask)
{
- options |= mbgl::MapDebugOptions::Wireframe;
+ options |= mbgl::MapDebugOptions::Overdraw;
}
_mbglMap->setDebug(options);
}
@@ -2182,8 +2182,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
mbgl::AnimationOptions animationOptions;
if (duration)
{
- animationOptions.duration = MGLDurationInSeconds(duration);
- animationOptions.easing = MGLUnitBezierForMediaTimingFunction(function);
+ animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
{
@@ -2335,8 +2335,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration = MGLDurationInSeconds(duration);
- animationOptions.easing = MGLUnitBezierForMediaTimingFunction(function);
+ animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
{
@@ -2442,8 +2442,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration = MGLDurationInSeconds(duration);
- animationOptions.easing = MGLUnitBezierForMediaTimingFunction(function);
+ animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
{
@@ -4556,7 +4556,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
MGLAnnotationContext &annotationContext = pair.second;
MGLAnnotationView *annotationView = annotationContext.annotationView;
-
+
+ // Defer to the shape/polygon styling delegate methods
+ if ([annotationContext.annotation isKindOfClass:[MGLMultiPoint class]])
+ {
+ continue;
+ }
+
if (!annotationView)
{
MGLAnnotationView *annotationView = [self annotationViewForAnnotation:annotationContext.annotation];
diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h
index 12a0658a51..db1327685a 100644
--- a/platform/ios/src/MGLMapViewDelegate.h
+++ b/platform/ios/src/MGLMapViewDelegate.h
@@ -204,12 +204,12 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the alpha value to use when rendering a shape annotation.
- A value of 0.0 results in a completely transparent shape. A value of 1.0, the
- default, results in a completely opaque shape.
+ A value of `0.0` results in a completely transparent shape. A value of `1.0`,
+ the default, results in a completely opaque shape.
@param mapView The map view rendering the shape annotation.
@param annotation The annotation being rendered.
- @return An alpha value between 0 and 1.0.
+ @return An alpha value between `0` and `1.0`.
*/
- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation;
@@ -241,7 +241,7 @@ NS_ASSUME_NONNULL_BEGIN
Returns the line width in points to use when rendering the outline of a
polyline annotation.
- By default, the polyline is outlined with a line 3.0 points wide.
+ By default, the polyline is outlined with a line `3.0` points wide.
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h
index 6160413510..81f9557b16 100644
--- a/platform/ios/src/MGLUserLocation.h
+++ b/platform/ios/src/MGLUserLocation.h
@@ -7,7 +7,12 @@
NS_ASSUME_NONNULL_BEGIN
-/** The MGLUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing MGLUserLocation object from the userLocation property of the map view displayed in your application. */
+/**
+ The MGLUserLocation class defines a specific type of annotation that identifies
+ the user’s current location. You do not create instances of this class
+ directly. Instead, you retrieve an existing MGLUserLocation object from the
+ `userLocation` property of the map view displayed in your application.
+ */
@interface MGLUserLocation : NSObject <MGLAnnotation>
#pragma mark Determining the User’s Position
@@ -15,17 +20,22 @@ NS_ASSUME_NONNULL_BEGIN
/**
The current location of the device. (read-only)
- This property contains `nil` if the map view is not currently showing the user location or if the user’s location has not yet been determined.
+ This property contains `nil` if the map view is not currently showing the user
+ location or if the user’s location has not yet been determined.
*/
@property (nonatomic, readonly, nullable) CLLocation *location;
-/** A Boolean value indicating whether the user’s location is currently being updated. (read-only) */
+/**
+ A Boolean value indicating whether the user’s location is currently being
+ updated. (read-only)
+ */
@property (nonatomic, readonly, getter=isUpdating) BOOL updating;
/**
The heading of the user location. (read-only)
- This property is `nil` if the user location tracking mode is not `MGLUserTrackingModeFollowWithHeading`.
+ This property is `nil` if the user location tracking mode is not
+ `MGLUserTrackingModeFollowWithHeading`.
*/
@property (nonatomic, readonly, nullable) CLHeading *heading;
diff --git a/platform/ios/src/MGLUserLocationAnnotationView.h b/platform/ios/src/MGLUserLocationAnnotationView.h
index 1eb50b7740..40432581fd 100644
--- a/platform/ios/src/MGLUserLocationAnnotationView.h
+++ b/platform/ios/src/MGLUserLocationAnnotationView.h
@@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
@class MGLMapView;
@class MGLUserLocation;
-/** View representing an MGLUserLocation on screen. */
+/** View representing an `MGLUserLocation` on screen. */
@interface MGLUserLocationAnnotationView : UIView
@property (nonatomic, weak) MGLMapView *mapView;