Data Detection in Swift
[]
The Atomic Birdhouse
var addresses = [String]() for match in matches { if let matchURL = match.url, let matchURLComponents = URLComponents(url: matchURL, resolvingAgainstBaseURL: false ), matchURLComponents.scheme == "mailto" { let address = matchURLComponents.path addresses.append(String(address)) } } extension String { /** Get email addresses in a string, discard any other content.