This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct ISOString { | |
/// Parse ISO 6709 string. | |
/// e.g. "+34.0595-118.4460+091.541/" | |
/// SeeAlso: [ISO 6709](https://en.wikipedia.org/wiki/ISO_6709) | |
public static func parse(iso6709 text: String?) -> CLLocation? { | |
guard | |
let results = text?.capture(pattern: "([+-][0-9.]+)([+-][0-9.]+)"), | |
let latitude = results[safe: 1] as NSString?, | |
let longitude = results[safe: 2] as NSString? | |
else { return nil } |