-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] fixes #5129 added annotation property to MGLAnnotationView #5307
Conversation
|
||
_expectation = [self expectationWithDescription:@"test annotation property"]; | ||
|
||
MGLTestAnnotation *annotation = [MGLTestAnnotation new]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use alloc/init rather than new. In general, using init directly makes it easier to add parameters to an initializer. (Admittedly, it used to matter more in the days before ARC.) In this codebase specifically, where many of the files are Objective-C++, we prefer to leave the new keyword to C++ usage.
#4837 adds a UI test bundle to the iOS project. Until then, you may be able to add this test to the existing unit test bundle, which otherwise only tests non-UI code that's shared between the iOS and OS X SDKs. |
fa87191
to
c550bdd
Compare
When the view is queued and waiting to be reused, the value will be set to nil. | ||
This property should not be changed directly. | ||
*/ | ||
@property (nonatomic, strong, nullable) id <MGLAnnotation> annotation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not look like there is a good reason for us to use the MK approach of warning about changing this property in the comment but not making it readonly. Let's go ahead and make it readonly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the reason MapKit leaves this property read-write is that a subclass might want to override -setAnnotation:
to do something special. At least, that’s the reason MapKit exposes -setSelected:animated:
publicly with a note saying never to call it (as seen in #5297).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The annotation corresponds to the visibility of the view so it could be useful to override in order to animate the adding of the annotations views. However, I'd also prefer to make this property readonly and maybe expose -mapView:didAddAnnotationViews:
Also added a test case for MGLAnnotationView
c550bdd
to
45cecef
Compare
👍 |
Also added a test case to make sure the
annotation
property is handled correctly but there's no reference to theplatform/ios/test/MGLAnnotationViewTests.m
file in the project file as I'm figuring out the details around #4641./cc @1ec5 @boundsj @friedbunny