[Swift Overlay] Enforce API contract of UIDropSession.loadObjects(ofClass:completion:)

Originator:zach
Number:rdar://32582079 Date Originated:05-June-2017 11:13 PM
Status:Duplicate/32524993 Resolved:false
Product:iOS + SDK Product Version:iOS 11 SDK Beta 1 (15A5278f) / Xcode Version 9.0 beta (9M136h) / swiftlang 900.0.43
Classification:Suggestion Reproducible:Always
 
Area:
UIKit

Summary:
The Foundation overlay shadows a method on UndoManager to enforce its API contract.

    func registerUndo<TargetType: AnyObject>(withTarget target: TargetType, handler: @escaping (TargetType) -> Void)

This makes the code much more enjoyable to use. UIDropSession.loadObjects(ofClass:completion:) follows the same convention and should be similarly overlaid.

Steps to Reproduce:
Use UIDropSession.loadObjects(ofClass:completion:).

Expected Results:
The contract of the method is enforced through the API.

Observed Results:
I must force-cast in order to write the completion method, creating two (albeit very close) encodings of the same fact that could potentially get out of sync.

Version:
iOS 11 SDK Beta 1 (15A5278f) / Xcode Version 9.0 beta (9M136h) / swiftlang 900.0.43

Notes:
The ObjC header can include NS_REFINED_FOR_SWIFT, or set the equivalent using apinotes.

Configuration:
All configurations that involve this API in Swift.

Comments

Apple Developer Bug Reporting

Engineering has determined that your bug report (32582079) is a duplicate of 32524993 and will be closed.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!