Extracting address elements from a String using NSDataDetector in Swift 3.0
问题 I'm attempting to use NSDataDetector to addresses from a string. I've taken a look at NSHipster's article on NSDataDetector as well as Apple's NSDataDetector documentation. I've got the following method to the point where it'll pull addresses out of a string: func getAddress(from dataString: String) -> [String] { let detector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.address.rawValue) let matches = detector.matches(in: dataString, options: [], range: NSRange(location: 0,