So in updating to Xcode 10 and Swift 4.2, of course I had to make a lot of changes in my project to update the syntax. I was able to rectify all issues except for one. I'm getting an error that says: 'MKMapRectIsNull' has been replaced by property 'MKMapRect.isNull'. I did the obvious thing of trying replacing MKMapRectIsNull with MKMapRect.isNull, but that generates another error which says: Instance member 'isNull' cannot be used on type 'MKMapRect'. Here's some more context:
var zoomRect = MKMapRect.null
for annotation in map.annotations {
let annotationPoint = MKMapPoint(annotation.coordinate)
let pointRect = MKMapRect(x: annotationPoint.x, y: annotationPoint.y, width: 0, height: 0)
if (MKMapRect.isNull(zoomRect)) {
zoomRect = pointRect
} else {
zoomRect = zoomRect.union(pointRect)
}
}
map.setVisibleMapRect(zoomRect, edgePadding: UIEdgeInsets(top: 40, left: 40, bottom: 40, right: 40), animated: true)
Any ideas/help would be appreciated.
For the condition if (MKMapRect.isNull(zoomRect)) you need to change that to if (zoomRect.isNull)
You cannot check the condition for MKMapRect type, only an instantiated object of that type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With