SPGeofencePolygon

@interface SPGeofencePolygon : SPGeofenceGeometry

Geofence consisting of a polygon. You may add holes to polygons that are excluded from hit detection.

A polygon is an array of SPGeofencePoint objects. Polygons must contain at least 3 points.

  • Recommended constructor for SPGeofencePolygon objects.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithIdentifier:(nonnull NSString *)identifier
                   polygon:(nonnull NSArray<SPGeofencePoint *> *)polygon
                      hole:(nullable NSArray<SPGeofencePoint *> *)hole;

    Swift

    init(identifier: String, polygon: [SPGeofencePoint], hole: [SPGeofencePoint]?)

    Parameters

    identifier

    unique name for geofence

    polygon

    list of points forming a polygon geometry

    hole

    optional list of points forming a polygon (hole) geometry

    Return Value

    new instance of SPGeofencePolygon

  • Declaration

    Objective-C

    - (nonnull NSArray<SPGeofencePoint *> *)polygon;

    Swift

    func polygon() -> [SPGeofencePoint]

    Return Value

    list of polygon points

  • Declaration

    Objective-C

    - (nullable NSArray<SPGeofencePoint *> *)hole;

    Swift

    func hole() -> [SPGeofencePoint]?

    Return Value

    list of polygon hole points