SKTilesetDataSource
public protocol SKTilesetDataSource : AnyObjectOverview
Methods which allow the user to dynamically alter the properties of a tileset as it is being created.
Instance Methods
Delegate callbacks are called asynchronously as the tileset is being rendered.
| Method | Description | 
|---|---|
| willAddSpriteSheet | Provide an image name for the tileset before textures are generated. | 
| willAddImage | Provide an alernate image name for an image in a collection. | 
Usage
Implementing the SKTilesetDataSource.willAddSpriteSheet method allows the user to specify different spritesheet images. Take care
that these images have the same dimensions & layout.
extension MyScene: SKTilesetDataSource {
    func willAddSpriteSheet(to tileset: SKTileset, fileNamed: String) -> String {
        if (currentSeason == .winter) {
            return "winter-tiles-16x16.png"
        }
        if (currentSeason == .summer) {
            return "summer-tiles-16x16.png"
        }
        return fileNamed
    }
}
- 
                  ▶︎willAddSpriteSheet(to:Default implementationfileNamed: ) Provide an image name for the tileset before textures are generated. Default ImplementationCalled when a tileset is about to render a spritesheet. DeclarationSwift func willAddSpriteSheet(to tileset: SKTileset, fileNamed: String) -> StringParameterstoSKTilesettileset instance.fileNamedStringspritesheet name.Return ValueStringspritesheet name.
- 
                  ▶︎willAddImage(to:Default implementationforId: fileNamed: ) Provide an alernate image name for an image in a collection. Default ImplementationCalled when a tileset is about to add an image from a collection. DeclarationSwift func willAddImage(to tileset: SKTileset, forId: Int, fileNamed: String) -> StringParameterstoSKTilesettileset instance.forIdInttile id.fileNamedStringimage name.Return ValueStringimage name.
 View on GitHub
            View on GitHub
           SKTilesetDataSource Protocol Reference
      SKTilesetDataSource Protocol Reference