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

[ios] Silence incompatible type warning for callout view #8608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT

## 3.5.1

### Other changes
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!


* Fixed an issue that caused the return type of a map view delegate method to bridge incorrectly to applications written in Swift. ([#8541](https://github.com/mapbox/mapbox-gl-native/pull/8541))

## 3.5.0
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/app/MBXViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ - (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUse
}];
}

- (UIView<MGLCalloutView> *)mapView:(__unused MGLMapView *)mapView calloutViewForAnnotation:(id<MGLAnnotation>)annotation
- (nullable id <MGLCalloutView>)mapView:(__unused MGLMapView *)mapView calloutViewForAnnotation:(id<MGLAnnotation>)annotation
{
if ([annotation respondsToSelector:@selector(title)]
&& [annotation isKindOfClass:[MBXCustomCalloutAnnotation class]])
Expand Down
9 changes: 8 additions & 1 deletion platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3761,7 +3761,14 @@ - (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated
UIView <MGLCalloutView> *calloutView;
if ([self.delegate respondsToSelector:@selector(mapView:calloutViewForAnnotation:)])
{
calloutView = [self.delegate mapView:self calloutViewForAnnotation:annotation];
id providedCalloutView = [self.delegate mapView:self calloutViewForAnnotation:annotation];
if (providedCalloutView) {
if (![providedCalloutView isKindOfClass:[UIView class]]) {
[NSException raise:NSInvalidArgumentException format:@"Callout view must be a kind of UIView"];
}
NSAssert([providedCalloutView conformsToProtocol:@protocol(MGLCalloutView)], @"callout view must conform to MGLCalloutView");
calloutView = providedCalloutView;
}
}
if (!calloutView)
{
Expand Down