TDM
TDM

Reputation: 814

'MKMapRectIsNull' has been replaced by property 'MKMapRect.isNull'

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.

Upvotes: 3

Views: 708

Answers (1)

Rhetorical
Rhetorical

Reputation: 183

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.

Upvotes: 5

Related Questions