[swift-evolution] [Out of scope][Discussion] Modernize MapKit functions for Swift API Design Guidelines

Scott Gardner scott.gardner at mac.com
Sun Jan 1 13:02:33 CST 2017


Hello Swift Community, and…

if Calendar.current.identifier == .gregorian {
    print("Happy new year! 🎉")
}

I would like to propose that the MapKit framework functions be updated to conform to the Swift API Design Guidelines.

For example, this is how you would currently determine if the user is currently within the visible map view:

let userPoint = MKMapPointForCoordinate(mapView.userLocation.coordinate)
let mapRect = mapView.visibleMapRect
let inside = MKMapRectContainsPoint(mapRect, userPoint)

This should be more easily accomplished, such as by doing this:

let userPoint = mapView.userLocation.coordinate.mapPoint
let inside = mapView.visibleMapRect.contains(userPoint)

There are 39 functions that should be updated:

https://developer.apple.com/reference/mapkit/1612565-mapkit_functions?language=swift <https://developer.apple.com/reference/mapkit/1612565-mapkit_functions?language=swift>

I realize that this proposal is out of scope for Swift 4. So I will develop it for consideration in a future release, and keep it updated on my fork until it’s ready to submit. All feedback welcomed and appreciated.

https://github.com/scotteg/swift-evolution/blob/master/proposals/mapkit-functions-for-swift-api-design-guideines.md <https://github.com/scotteg/swift-evolution/blob/master/proposals/mapkit-functions-for-swift-api-design-guideines.md>

Cheers,
Scott

--
Scott Gardner
https://github.com/scotteg <https://github.com/scotteg>
scotteg.com <http://scotteg.com/>
@scotteg <https://twitter.com/scotteg>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170101/85570f88/attachment.html>


More information about the swift-evolution mailing list