Instance Method

distance(from:)

Returns the distance value parsed from the specified string.

Declaration

func distance(from distance: String) -> CLLocationDistance

Parameters

distance

A formatted string that specifies a distance.

Return Value

The distance value represented by the string or -1.0 if the string does not contain a recognized distance value.

Discussion

This method searches the provided string for a number that could represent a distance. Distances must be specified as purely numerical values. Do not specify distances as fractions such as "1/4 mile".

See Also

Converting Distances

func string(fromDistance: CLLocationDistance) -> String

Creates a string representation of the specified distance.