NSDataDetector.init is awkward in Swift

Originator:an00na
Number:rdar://36238473 Date Originated:December 29 2017, 10:38 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.2
Classification:Suggestion Reproducible:
 
Area:
Foundation

NSDataDetector.init(:)'s argument type is NSTextCheckingTypes but one has to actually use NSTextCheckingResult.CheckingType.rawValue, e.g.:
let detector = NSDataDetector(types: NSTextCheckingResult.CheckingType.date.rawValue)

I think the appropriate type should be an OptionSet.

Comments


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!