MGLVectorSource

@interface MGLVectorSource : MGLSource

A vector tile source. Tiles must be in Mapbox Vector Tile format.

  • Returns a vector source initialized with an identifier and TileJSON URL.

    After initializing and configuring the source, add it to a map view’s style using the -[MGLStyle addSource:] method.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier
                                           URL:(nonnull NSURL *)url;

    Swift

    init(identifier: String, url: URL)

    Parameters

    identifier

    A string that uniquely identifies the source in the style to which it is added.

    url

    A URL to a TileJSON configuration file describing the source’s contents and other metadata.

    Return Value

    An initialized vector source.

  • Returns a vector source initialized an identifier and tile set.

    After initializing and configuring the source, add it to a map view’s style using the -[MGLStyle addSource:] method.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier
                                       tileSet:(nonnull MGLTileSet *)tileSet;

    Swift

    init(identifier: String, tileSet: MGLTileSet)

    Parameters

    identifier

    A string that uniquely identifies the source in the style to which it is added.

    tileSet

    A tile set describing the source’s contents and other metadata.

    Return Value

    An initialized vector source.

  • URL

    A URL to a TileJSON configuration file describing the source’s contents and other metadata.

    The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the tile set’s map ID (mapbox://<mapid>).

    If the receiver was initialized using -initWithIdentifier:tileSet:, this property is set to nil.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSURL *_Nonnull URL;

    Swift

    var url: URL { get }
  • A tile set describing the source’s contents and other metadata.

    If the receiver was initialized using -initWithIdentifier:URL:, this property is set to nil.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) MGLTileSet *tileSet;

    Swift

    var tileSet: MGLTileSet? { get }