Skip to content

Instantly share code, notes, and snippets.

@freak4pc
Last active September 5, 2024 06:36
Show Gist options
  • Save freak4pc/98c813d8adb8feb8aee3a11d2da1373f to your computer and use it in GitHub Desktop.
Save freak4pc/98c813d8adb8feb8aee3a11d2da1373f to your computer and use it in GitHub Desktop.

Revisions

  1. freak4pc renamed this gist Apr 5, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. freak4pc revised this gist Jul 8, 2018. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions MKPolyline+Ext.swift
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    public extension MKPolyline {
    public var coordinates: [CLLocationCoordinate2D] {
    public extension MKMultiPoint {
    var coordinates: [CLLocationCoordinate2D] {
    var coords = [CLLocationCoordinate2D](repeating: kCLLocationCoordinate2DInvalid,
    count: self.pointCount)
    count: pointCount)

    self.getCoordinates(&coords, range: NSRange(location: 0, length: self.pointCount))
    getCoordinates(&coords, range: NSRange(location: 0, length: pointCount))

    return coords
    return coords
    }
    }

  3. freak4pc created this gist Feb 12, 2017.
    13 changes: 13 additions & 0 deletions MKPolyline+Ext.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    public extension MKPolyline {
    public var coordinates: [CLLocationCoordinate2D] {
    var coords = [CLLocationCoordinate2D](repeating: kCLLocationCoordinate2DInvalid,
    count: self.pointCount)

    self.getCoordinates(&coords, range: NSRange(location: 0, length: self.pointCount))

    return coords
    }
    }

    // Given a MKRoute, you can just do:
    // route.polyline.coordinates