Functions
The following functions are available globally.
-
This function encodes an
[CLLocationCoordinate2D]
to aString
Declaration
Swift
public func encodeCoordinates(_ coordinates: [CLLocationCoordinate2D], precision: Double = 1e5) -> String
Parameters
coordinates
The
Array
ofCLLocationCoordinate2D
that you want to encodeprecision
The precision used to encode coordinates (default:
1e5
)Return Value
A
String
representing the encoded Polyline -
This function encodes an
[CLLocation]
to aString
Declaration
Swift
public func encodeLocations(_ locations: [CLLocation], precision: Double = 1e5) -> String
Parameters
coordinates
The
Array
ofCLLocation
that you want to encodeprecision
The precision used to encode locations (default:
1e5
)Return Value
A
String
representing the encoded Polyline -
This function encodes an
[UInt32]
to aString
Declaration
Swift
public func encodeLevels(_ levels: [UInt32]) -> String
Parameters
levels
The
Array
ofUInt32
levels that you want to encodeReturn Value
A
String
representing the encoded Levels -
This function decodes a
String
to a[CLLocationCoordinate2D]?
Declaration
Swift
public func decodePolyline(_ encodedPolyline: String, precision: Double = 1e5) -> [CLLocationCoordinate2D]?
Parameters
encodedPolyline
String
representing the encoded Polylineprecision
The precision used to decode coordinates (default:
1e5
)Return Value
A
[CLLocationCoordinate2D]
representing the decoded polyline if valid,nil
otherwise -
This function decodes a String to a [CLLocation]?
Declaration
Swift
public func decodePolyline(_ encodedPolyline: String, precision: Double = 1e5) -> [CLLocation]?
Parameters
encodedPolyline
String representing the encoded Polyline
precision
The precision used to decode locations (default: 1e5)
Return Value
A [CLLocation] representing the decoded polyline if valid, nil otherwise
-
This function decodes a
String
to an[UInt32]
Declaration
Swift
public func decodeLevels(_ encodedLevels: String) -> [UInt32]?
Parameters
encodedLevels
The
String
representing the levels to decodeReturn Value
A
[UInt32]
representing the decoded Levels if theString
is valid,nil
otherwise