ashwini technopurple
ashwini technopurple

Reputation: 81

How to draw Polygon using multiple coordinate (Without using MKPolygon) and check if current location is in Polygon in Swift 3

I want to draw Polygon using n number of coordinate (But don't want to use MKPolygon bcz I don't have any Map view just doing all this programmatically). And also want to check if my current location is in Polygon. I want this to be done in Swift 3.

Thanks!

Upvotes: 1

Views: 448

Answers (1)

Mark Bessey
Mark Bessey

Reputation: 19782

UIBezierPath will draw simple polygons (among other shapes), and has a convenient contains() function to check wether a point is inside the area of the path.

https://developer.apple.com/documentation/uikit/uibezierpath?changes=latest_minor

Upvotes: 2

Related Questions