iOS Developer Library

Developer

Core Location Functions Reference

Options
Deployment Target:

On This Page
Language:

Core Location Functions Reference

The Core Location framework provides functions to help you work with coordinate values.

Functions

  • Returns a Boolean indicating whether the specified coordinate is valid.

    Declaration

    Swift

    func CLLocationCoordinate2DIsValid(_ coord: CLLocationCoordinate2D) -> Bool

    Objective-C

    BOOL CLLocationCoordinate2DIsValid ( CLLocationCoordinate2D coord );

    Parameters

    coord

    A coordinate containing latitude and longitude values.

    Return Value

    YEStrue if the coordinate is valid or NOfalse if it is not.

    Discussion

    A coordinate is considered invalid if it meets at least one of the following criteria:

    • Its latitude is greater than 90 degrees or less than -90 degrees.

    • Its longitude is greater than 180 degrees or less than -180 degrees.

    Import Statement

    import CoreLocation

    Availability

    Available in iOS 4.0 and later.

  • Formats a latitude and longitude value into a coordinate data structure format.

    Declaration

    Swift

    func CLLocationCoordinate2DMake(_ latitude: CLLocationDegrees, _ longitude: CLLocationDegrees) -> CLLocationCoordinate2D

    Objective-C

    CLLocationCoordinate2D CLLocationCoordinate2DMake ( CLLocationDegrees latitude, CLLocationDegrees longitude );

    Parameters

    latitude

    The latitude for the new coordinate.

    longitude

    The longitude for the new coordinate.

    Return Value

    A coordinate structure encompassing the latitude and longitude values.

    Import Statement

    import CoreLocation

    Availability

    Available in iOS 4.0 and later.