I can't for the life of me figure this one out. I have been able to get annotations on the map and create a new Rect to hold them and set the map to that rect but my issue is obviously these annotations are right at the very edges of my map and I would like to add some extra space. Here is what they look like currently
And the code to generate this is
...
@IBOutlet var mapOutlet: WKInterfaceMap!
...
// setup a null MpRect
var zoomRect = MKMapRect.null;
// set lat and lon
let lat = data?["latitude"] as! Double
let lon = data?["longitude"] as! Double
let phoneLat = 32.801296
let phoneLon = -79.898318
// create coordinates
let myLocation = CLLocationCoordinate2D(latitude: lat, longitude: lon)
let phoneLocation = CLLocationCoordinate2D(latitude: phoneLat, longitude: phoneLon)
// setup location points
let myLocationPoint = MKMapPoint(myLocation)
let phoneLocationPoint = MKMapPoint(phoneLocation)
// setup MapRects
let myLocationRect = MKMapRect(x: myLocationPoint.x, y: myLocationPoint.y, width: 0.1, height: 0.1)
let phoneLocationRect = MKMapRect(x: phoneLocationPoint.x, y: phoneLocationPoint.y, width: 0.1, height: 0.1)
// setup MapRect union
zoomRect = myLocationRect;
zoomRect = zoomRect.union(phoneLocationRect);
mapOutlet.setVisibleMapRect(zoomRect)
mapOutlet.addAnnotation(myLocation, with: .red)
mapOutlet.addAnnotation(phoneLocation, with: .purple)