CLRegion

open class CLRegion : NSObject, NSCopying, NSSecureCoding

A geographic region that you monitor using location services. Apple Documentation

  • The unique identifier for the region.

    Declaration

    Swift

    public let identifier: String
  • The center point of the region (latitude and longitude).

    Declaration

    Swift

    public let center: CLLocationCoordinate2D
  • The radius of the region in meters.

    Declaration

    Swift

    public let radius: CLLocationDistance
  • Indicates whether the region triggers entry events.

    Declaration

    Swift

    public var notifyOnEntry: Bool
  • Indicates whether the region triggers exit events.

    Declaration

    Swift

    public var notifyOnExit: Bool

Secure Coding Conformance

  • Required for NSSecureCoding

    Declaration

    Swift

    public static let supportsSecureCoding: Bool
  • Initializes a region with the specified center and radius.

    Declaration

    Swift

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

    Parameters

    center

    The geographical center of the region.

    radius

    The radius of the region in meters.

    identifier

    A unique string identifier for the region.

  • Decodes an instance of CLRegion from an NSCoder.

    Declaration

    Swift

    required public init?(coder: NSCoder)

    Parameters

    coder

    The NSCoder object used for decoding.

  • Encodes an instance of CLRegion into an NSCoder.

    Declaration

    Swift

    public func encode(with coder: NSCoder)

    Parameters

    coder

    The NSCoder object used for encoding.

  • Checks whether a specific coordinate is inside the region.

    Declaration

    Swift

    public func contains(_ coordinate: CLLocationCoordinate2D) -> Bool

    Parameters

    coordinate

    The coordinate to check.

    Return Value

    A Boolean indicating if the coordinate is within the region’s boundaries.

NSCopying Conformance

  • Creates a copy of this CLRegion instance.

    Declaration

    Swift

    public func copy(with zone: NSZone? = nil) -> Any

    Parameters

    zone

    The zone in which to allocate the new object (default: nil).

    Return Value

    A new CLRegion object with the same properties.

Hashable Conformance

  • Undocumented

    Declaration

    Swift

    public static func == (lhs: CLRegion, rhs: CLRegion) -> Bool
  • Undocumented

    Declaration

    Swift

    public override func isEqual(_ object: Any?) -> Bool
  • Undocumented

    Declaration

    Swift

    public override var hash: Int { get }