简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM