summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.h
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2018-07-20 14:14:43 -0700
committerGitHub <noreply@github.com>2018-07-20 14:14:43 -0700
commit681e0141de63d0d5a545e87c40216163b2d63fc6 (patch)
tree0253e9980ca3c8a75d8f2e04dae8d69f1ef667bd /platform/ios/src/MGLMapView.h
parentbbccce18c4d064054726f66e0b9b41cebfe314e4 (diff)
downloadqtlocation-mapboxgl-681e0141de63d0d5a545e87c40216163b2d63fc6.tar.gz
[ios] Mapbox's Location Manager new API. (#12013)
* [ios] The new location manager API provides two new protocols MGLLocationManager and MGLLocationManagerDelegate to handle the location cycle and updates respectively. This enables developers to chose the appropriate location provider according to their needs, or transition between outdoors/indoors location updates. It does provide a default implementation based on CLLocationManager.
Diffstat (limited to 'platform/ios/src/MGLMapView.h')
-rw-r--r--platform/ios/src/MGLMapView.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 04a7a06313..b2439416ae 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -2,7 +2,6 @@
#import "MGLMapCamera.h"
#import <UIKit/UIKit.h>
-#import <CoreLocation/CoreLocation.h>
#import "MGLFoundation.h"
#import "MGLTypes.h"
@@ -22,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol MGLOverlay;
@protocol MGLCalloutView;
@protocol MGLFeature;
+@protocol MGLLocationManager;
/** The default deceleration rate for a map view. */
extern MGL_EXPORT const CGFloat MGLMapViewDecelerationRateNormal;
@@ -297,6 +297,24 @@ MGL_EXPORT IB_DESIGNABLE
#pragma mark Displaying the User’s Location
/**
+ The object that this map view uses to start and stop the delivery of location-related
+ updates.
+
+ To receive the current user location, implement the `-[MGLMapViewDelegate mapView:didUpdateUserLocation:]`
+ and `-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]` methods.
+
+ If setting this property to `nil` and setting `showsUserLocation` to `YES`, or
+ if no custom manager is provided this property is set to the default
+ location manager.
+
+ `MGLMapView` uses a default location manager. If you want to substitute your own
+ location manager, you should do so by setting this property before setting
+ `showsUserLocation` to `YES`. To restore the default location manager,
+ set this property to `nil`.
+ */
+@property (nonatomic, null_resettable) id<MGLLocationManager> locationManager;
+
+/**
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
@@ -312,6 +330,9 @@ MGL_EXPORT IB_DESIGNABLE
`NSLocationAlwaysUsageDescription` in its `Info.plist` to satisfy the
requirements of the underlying Core Location framework when enabling this
property.
+
+ If you implement a custom location manager, set the `locationManager` before
+ calling `showsUserLocation`.
*/
@property (nonatomic, assign) BOOL showsUserLocation;