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
| extension CLLocationCoordinate2D: Equatable { | |
| public static func == (lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool { | |
| let numbersAfterCommaAccuracy: Double = 4 | |
| let ratio = numbersAfterCommaAccuracy * 10 | |
| let isLatitudeEqual = ((lhs.latitude - rhs.latitude) * ratio).rounded(.down) == 0 | |
| let isLongitudeEqual = ((lhs.latitude - rhs.latitude) * ratio).rounded(.down) == 0 | |
| return isLatitudeEqual && isLongitudeEqual | |
| } | |
| } |
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
| func drawRectange(){ | |
| /* create the path */ | |
| let path = GMSMutablePath() | |
| path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0)) | |
| path.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.0)) | |
| path.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.2)) | |
| path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.2)) | |
| path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0)) | |
| /* show what you have drawn */ |