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


(Scott Gardner) #1

Hello Swift Community, and…

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

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

Cheers,
Scott

···

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


(Saagar Jha) #2

MapKit is not part of the Swift standard library; as such, it would probably be better if you used Apple’s Bug Reporter to let them know.

Saagar Jha

···

On Jan 1, 2017, at 11:02 AM, Scott Gardner via swift-evolution <swift-evolution@swift.org> wrote:

Hello Swift Community, and…

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

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

Cheers,
Scott

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

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Dan Stenmark) #3

Swift-evolution is for talking about the core language and its standard libraries (String, Array, Optional, etc), not high level frameworks like MapKit. For that, you'll want to file a Radar at http://bugreport.apple.com/.

Dan

···

On Jan 1, 2017, at 11:02 AM, Scott Gardner via swift-evolution <swift-evolution@swift.org> wrote:

Hello Swift Community, and…

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

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

Cheers,
Scott

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

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Scott Gardner) #4

Realized that after sending. I'll file a radar. Thanks!

···

Sent from my iPhone

On Jan 1, 2017, at 4:03 PM, Dan Stenmark <daniel.j.stenmark@gmail.com> wrote:

Swift-evolution is for talking about the core language and its standard libraries (String, Array, Optional, etc), not high level frameworks like MapKit. For that, you'll want to file a Radar at http://bugreport.apple.com/.

Dan

On Jan 1, 2017, at 11:02 AM, Scott Gardner via swift-evolution <swift-evolution@swift.org> wrote:

Hello Swift Community, and…

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

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

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

Cheers,
Scott

--
Scott Gardner
https://github.com/scotteg
scotteg.com
@scotteg

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution