Initializes and returns a tile overlay object using the specified tile-access template.


init(urlTemplate URLTemplate: String?)



A string that can be used to build a URL to access your tile images. The string you specify can point to a local file or to an image on a remote server. To facilitate retrieving multiple tiles using the string, use the placeholder values {x}, {y}, {z}, and {scale} as stand-ins for the x and y tile indexes, the zoom level, and the resolution of the tile image. If this parameter is nil, you must provide custom implementations for the tile-loading methods of this class.

Return Value

An initialized tile overlay object.


The default tile overlay object uses the template string you specify to request tiles. This template string should incorporate the {x}, {y}, {z}, and {scale} placeholder strings to facilitate the creation of a URL for requesting the appropriate tile. For example, if you have a server that vends tiles when you provide a URL of the form http://myserver/tile?x=0&y=0&z=0&scale=1.0, you would specify a template string of http://myserver/tile?x={x}&y={y}&z={z}&scale={scale}. The tile overlay object substitutes actual index values in for your template’s placeholders before requesting the actual tile.

See Also