# GMSTileLayer

    @interface GMSTileLayer : NSObject

`GMSTileLayer` is an abstract class that allows overlaying of custom image tiles on a specified
`https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.html`. It may not be initialized directly, and subclasses must implement the
tileForX:y:zoom: method to return tiles.

At zoom level 0 the whole world is a square covered by a single tile, and the coordinates `x` and
`y` are both 0 for that tile. At zoom level 1, the world is covered by 4 tiles with `x` and `y`
being 0 or 1, and so on.
- `


  ### [-requestTileForX:y:zoom:receiver:](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(im)requestTileForX:y:zoom:receiver:)


  ` `-requestTileForX:y:zoom:receiver:` generates image tiles for `GMSTileOverlay`. It must be
  overridden by subclasses. The tile for the given `x`, `y` and `zoom` *must* be later passed to
  `receiver`.

  Specify `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Constants/kGMSTileLayerNoTile.html` if no tile is available for this location; or nil if a transient
  error occurred and a tile may be available later.

  Calls to this method will be made on the main thread. See `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSSyncTileLayer.html` for a base class
  that implements a blocking tile layer that does not run on your application's main thread.

  #### Declaration

  Swift

      func requestTileFor(x: UInt, y: UInt, zoom: UInt, receiver: any https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSTileReceiver.html)

  Objective-C

      - (void)requestTileForX:(NSUInteger)x
                            y:(NSUInteger)y
                         zoom:(NSUInteger)zoom
                     receiver:(nonnull id<https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSTileReceiver.html>)receiver;

- `


  ### [-clearTileCache](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(im)clearTileCache)


  ` Clears the cache so that all tiles will be requested again.

  #### Declaration

  Swift

      func clearTileCache()

  Objective-C

      - (void)clearTileCache;

- `


  ### [map](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(py)map)


  ` The map this `GMSTileOverlay` is displayed on. Setting this property will add the layer to the
  map. Setting it to nil removes this layer from the map. A layer may be active on at most one map
  at any given time.

  #### Declaration

  Swift

      weak var map: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.html? { get set }

  Objective-C

      @property (nonatomic, weak, nullable) https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.html *map;

- `


  ### [zIndex](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(py)zIndex)


  ` Higher `zIndex` value tile layers will be drawn on top of lower `zIndex` value tile layers and
  overlays. Equal values result in undefined draw ordering.

  #### Declaration

  Swift

      var zIndex: Int32 { get set }

  Objective-C

      @property (nonatomic) int zIndex;

- `


  ### [tileSize](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(py)tileSize)


  ` Specifies the number of pixels (not points) that the returned tile images will prefer to display
  as. For best results, this should be the edge length of your custom tiles. Defaults to 256, which
  is the traditional size of Google Maps tiles.

  Values less than the equivalent of 128 points (e.g. 256 pixels on retina devices) may not perform
  well and are not recommended.

  As an example, an application developer may wish to provide retina tiles (512 pixel edge length)
  on retina devices, to keep the same number of tiles
  per view as the default value of 256 would give on a non-retina device.

  #### Declaration

  Swift

      var tileSize: Int { get set }

  Objective-C

      @property (nonatomic) NSInteger tileSize;

- `


  ### [opacity](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(py)opacity)


  ` Specifies the opacity of the tile layer. This provides a multiplier for the alpha channel of tile
  images.

  #### Declaration

  Swift

      var opacity: Float { get set }

  Objective-C

      @property (nonatomic) float opacity;

- `


  ### [fadeIn](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSTileLayer#/c:objc(cs)GMSTileLayer(py)fadeIn)


  ` Specifies whether the tiles should fade in. Default YES.

  #### Declaration

  Swift

      var fadeIn: Bool { get set }

  Objective-C

      @property (nonatomic) BOOL fadeIn;