iOS Developer Library

Developer

CoreLocation Framework Reference CLCircularRegion Class Reference

Options
Deployment Target:

On This Page
Language:

CLCircularRegion

Inherits From


Conforms To


Import Statement


Swift

import CoreLocation

Objective-C

@import CoreLocation;

Availability


Available in iOS 7.0 and later

The CLCircularRegion class defines the location and boundaries for a circular geographic region. You can use instances of this class to define geo fences for a specific location. The crossing of a geo fence’s boundary causes the location manager to notify its delegate.

  • Initializes and returns a region object defining a circular geographic area.

    Declaration

    Swift

    init!(center center: CLLocationCoordinate2D, radius radius: CLLocationDistance, identifier identifier: String!)

    Objective-C

    - (instancetype)initWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius identifier:(NSString *)identifier

    Parameters

    center

    The center point of the geographic region to monitor.

    radius

    The distance (measured in meters) from the center point of the geographic region to the edge of the circular boundary.

    identifier

    A unique identifier to associate with the region object. You use this identifier to differentiate regions within your application. This value must not be nil.

    Return Value

    An initialized region object.

    Discussion

    When defining a geographic region, remember that the location manager does not generate notifications immediately upon crossing a region boundary. Instead, it applies time and distance criteria to ensure that the crossing was intended and should genuinely trigger a notification. So choose a center point and radius that are appropriate and give you enough time to alert the user. For more information, see the information about region monitoring in Location and Maps Programming Guide.

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 7.0 and later

  • center center Property

    The center point of the geographic area. (read-only)

    Declaration

    Swift

    var center: CLLocationCoordinate2D { get }

    Objective-C

    @property(readonly, nonatomic) CLLocationCoordinate2D center

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 7.0 and later

  • radius radius Property

    The radius (measured in meters) that defines the geographic area’s outer boundary. (read-only)

    Declaration

    Swift

    var radius: CLLocationDistance { get }

    Objective-C

    @property(readonly, nonatomic) CLLocationDistance radius

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 7.0 and later

  • Returns a Boolean value indicating whether the geographic area contains the specified coordinate.

    Declaration

    Swift

    func containsCoordinate(_ coordinate: CLLocationCoordinate2D) -> Bool

    Objective-C

    - (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinate

    Parameters

    coordinate

    The coordinate to test against the region.

    Return Value

    YEStrue if the coordinate lies within the region’s boundaries or NOfalse if it does not.

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 7.0 and later