Created
October 3, 2017 19:26
-
-
Save DejanEnspyra/49d2de95609f67f0050e18593008708b to your computer and use it in GitHub Desktop.
Polygon Google Maps iOS SDK
This file contains 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 polygon(){ | |
// Create a rectangular path | |
let rect = GMSMutablePath() | |
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.0)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.2)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.2)) | |
// Create the polygon, and assign it to the map. | |
let polygon = GMSPolygon(path: rect) | |
polygon.fillColor = UIColor(red: 0.25, green: 0, blue: 0, alpha: 0.2); | |
polygon.strokeColor = .black | |
polygon.strokeWidth = 2 | |
polygon.map = mapView | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment