Amit
Amit

Reputation: 535

How to use PolyLine to draw path between two coordinates in Swift iOS

This method is mentioned and explained in apple's documentation. Can someone guide me on how to use it ?

 convenience init(coordinates coords: CMutablePointer<CLLocationCoordinate2D>, count: Int)

Upvotes: 1

Views: 2191

Answers (1)

Grimxn
Grimxn

Reputation: 22477

You could use it like this:

let c1 = CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0)
let c2 = CLLocationCoordinate2D(latitude: 1.0, longitude: 1.0)
var a = [c1, c2]

var polyline = MKPolyline(coordinates: &a, count: a.count)

I can't see a "Swifter" way to create MKPolylines in the docs... I assume they are still building the bridge, here.

Upvotes: 2

Related Questions