PFPolygon

@interface PFPolygon : NSObject <NSCopying, NSCoding>

PFPolygon may be used to embed a latitude / longitude points as the value for a key in a PFObject. It could be used to perform queries in a geospatial manner using PFQuery.-whereKey:polygonContains:.

  • Creates a new PFPolygon object for the given CLLocation, set to the location’s coordinates.

    Declaration

    Objective-C

    + (nonnull instancetype)polygonWithCoordinates:(nonnull NSArray *)coordinates;

    Swift

    convenience init(coordinates: [Any])

    Parameters

    coordinates

    Array of CLLocation, PFGeoPoint or (lat,lng)

    Return Value

    Returns a new PFPolygon at specified location.

  • Test if this polygon contains a point

    Declaration

    Objective-C

    - (BOOL)containsPoint:(nonnull PFGeoPoint *)point;

    Swift

    func contains(_ point: PFGeoPoint) -> Bool

    Parameters

    point

    PFGeoPoint to test

    Return Value

    Returns a boolean.

  • Array of PFGeoPoints or CLLocations

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) NSArray *_Nonnull coordinates;

    Swift

    var coordinates: [Any] { get set }