Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[ios, macos] Add overlays property to MGLMapView.mm #8617

Merged
merged 9 commits into from
May 21, 2017
Merged

[ios, macos] Add overlays property to MGLMapView.mm #8617

merged 9 commits into from
May 21, 2017

Conversation

eimantas
Copy link
Contributor

@eimantas eimantas commented Apr 2, 2017

Implemented by filtering the annotations property for
annotations that conform to MGLOverlay protocol.

Fixes #4281.

@eimantas eimantas changed the title Add overlays property to MGLMapView.mm [ios, macos] Add overlays property to MGLMapView.mm Apr 4, 2017
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I didn’t notice this PR fly by – sorry for the delay! This looks almost good to go, but there are a couple issues to resolve first. Also, would you do the honors and add a note to the changelogs describing the MGLMapView addition.

overlays are associated with the map view, the value of this property is
`nil`.
*/
@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLOverlay>) *overlays;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of iOS 9, MKMapView.annotations and MKMapView.overlays have changed to being non-nullable, returning an empty array when the map contains no annotation or no overlay. This would be a good opportunity to follow suit. (Since making the property non-nullable would also change it from optional to non-optional in Swift, we whould need to add a blurb to both changelogs about this change.)

{
if (self.annotations == nil) { return nil; }

NS_MUTABLE_ARRAY_OF(id <MGLOverlay>) *mutableOverlays = [NSMutableArray new];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use +[NSMutableArray array] instead of +[NSMutableArray new]. In general, we avoid +new because it’s inconsistent with the normal init pattern.

@eimantas
Copy link
Contributor Author

Should I match [non]nullability to macOS SDK too?

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good! (We can always take care of the annotations property's nullability in a separate PR, since that would have the potential to be more disruptive than this change.)

@1ec5 1ec5 self-assigned this May 12, 2017
@1ec5 1ec5 added annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS labels May 20, 2017
Eimantas Vaiciunas and others added 9 commits May 20, 2017 19:55
@1ec5 1ec5 merged commit 9e6a79a into mapbox:master May 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants