You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
signature for callOutViewFor:annotation should have MGLCalloutView return type #8420
func mapView(_ mapView: MGLMapView, calloutViewFor annotation: MGLAnnotation) -> UIView? as a signature is misleading since the function expects the return UIView to conform to MGLCalloutView and will cause a crash because of sending incorrect selectors. The return type should be changed to MGLCalloutView in order to reflect this.
changed the title [-][ios][macos] signature for callOutViewFor:annotation should have MGLCalloutView return type[/-][+]signature for callOutViewFor:annotation should have MGLCalloutView return type[/+]on Mar 17, 2017
Retitling, because macOS is unaffected: -[MGLMapViewDelegate mapView:calloutViewControllerForAnnotation:] returns an NSViewController, and the return value is always treated as a plain NSViewController.
/mapbox-gl-native/platform/ios/src/MGLMapView.mm:3764:27: Incompatible pointer types assigning to 'UIView<MGLCalloutView> *' from 'id<MGLCalloutView> _Nullable'
The naming of MGLCalloutView protocol and its documentation make the correct choice for what base type to return fairly obvious. However, I think we should guard against using objects that are not a kind of UIView and, if they are views, cast them as such to silence the warning.
Activity
[-][ios][macos] signature for callOutViewFor:annotation should have MGLCalloutView return type[/-][+]signature for callOutViewFor:annotation should have MGLCalloutView return type[/+]1ec5 commentedon Mar 17, 2017
Retitling, because macOS is unaffected:
-[MGLMapViewDelegate mapView:calloutViewControllerForAnnotation:]returns an NSViewController, and the return value is always treated as a plain NSViewController.boundsj commentedon Mar 30, 2017
This was fixed by #8541 that landed in the
release-ios-v3.5.0-android-v5.0.0branch and will be in the ios v3.5.1 patch releaseboundsj commentedon Mar 30, 2017
Reopening.
Unfortunately, I missed that this change causes a warning in
MGLMapView:triggers:
The naming of
MGLCalloutViewprotocol and its documentation make the correct choice for what base type to return fairly obvious. However, I think we should guard against using objects that are not a kind ofUIViewand, if they are views, cast them as such to silence the warning.cc @1ec5