summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2017-03-02 18:19:23 -0500
committerGitHub <noreply@github.com>2017-03-02 18:19:23 -0500
commit8a5cc3560ac3ed5b2aa6273c7fbbd92a3692b1ec (patch)
treec90ccbb114272bd293a3d3e0b15ac630c3484f60
parente1c85e8ec3c66efa6a5da987b639c7c32aa68169 (diff)
downloadqtlocation-mapboxgl-8a5cc3560ac3ed5b2aa6273c7fbbd92a3692b1ec.tar.gz
[ios] MGLAnnotationView annotation property made writable (#8139)
-rw-r--r--platform/ios/src/MGLAnnotationView.h2
-rw-r--r--platform/ios/src/MGLAnnotationView.mm2
-rw-r--r--platform/ios/src/MGLAnnotationView_Private.h1
-rw-r--r--platform/ios/src/MGLMapView.mm1
4 files changed, 3 insertions, 3 deletions
diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h
index 532483350a..184efdb324 100644
--- a/platform/ios/src/MGLAnnotationView.h
+++ b/platform/ios/src/MGLAnnotationView.h
@@ -89,7 +89,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
contains a non-`nil` value while the annotation view is visible on the map. If
the view is queued, waiting to be reused, the value is `nil`.
*/
-@property (nonatomic, readonly, nullable) id <MGLAnnotation> annotation;
+@property (nonatomic, nullable) id <MGLAnnotation> annotation;
/**
The string that identifies that this annotation view is reusable.
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index 5b105cde72..0e904779d5 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -10,7 +10,6 @@
@interface MGLAnnotationView () <UIGestureRecognizerDelegate>
@property (nonatomic, readwrite, nullable) NSString *reuseIdentifier;
-@property (nonatomic, readwrite, nullable) id <MGLAnnotation> annotation;
@property (nonatomic, readwrite) CATransform3D lastAppliedScaleTransform;
@property (nonatomic, weak) UIPanGestureRecognizer *panGestureRecognizer;
@property (nonatomic, weak) UILongPressGestureRecognizer *longPressRecognizer;
@@ -240,6 +239,7 @@
}
else if (dragState == MGLAnnotationViewDragStateCanceling)
{
+ NSAssert(self.annotation, @"Annotation property should not be nil.");
self.panGestureRecognizer.enabled = NO;
self.longPressRecognizer.enabled = NO;
self.center = [self.mapView convertCoordinate:self.annotation.coordinate toPointToView:self.mapView];
diff --git a/platform/ios/src/MGLAnnotationView_Private.h b/platform/ios/src/MGLAnnotationView_Private.h
index 8a0af3565c..c4695051c5 100644
--- a/platform/ios/src/MGLAnnotationView_Private.h
+++ b/platform/ios/src/MGLAnnotationView_Private.h
@@ -8,7 +8,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface MGLAnnotationView (Private)
@property (nonatomic, readwrite, nullable) NSString *reuseIdentifier;
-@property (nonatomic, readwrite, nullable) id <MGLAnnotation> annotation;
@property (nonatomic, weak) MGLMapView *mapView;
@end
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 7119544158..58f8f407e4 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1516,6 +1516,7 @@ public:
{
if (view.centerOffset.dx != 0 || view.centerOffset.dy != 0) {
if (CGRectContainsPoint(view.frame, tapPoint)) {
+ NSAssert(view.annotation, @"Annotation's view annotation property should not be nil.");
CGPoint annotationPoint = [self convertCoordinate:view.annotation.coordinate toPointToView:self];
tapPoint = annotationPoint;
}