MaplyRemoteTileSourceDelegate
@protocol MaplyRemoteTileSourceDelegate <NSObject>
A delegate called during various parts of the tile loading and display operation.
The remote tile source delegate provides feedback on which tiles loaded and which didn’t. You’ll be called in all sorts of random threads here, so act accordingly.
This delegate interface can also be used to modify data as it comes in.
-
The tile successfully loaded.
Declaration
Objective-C
- (void)remoteTileSource:(id _Nonnull)tileSource tileDidLoad:(MaplyTileID)tileID;
Swift
optional func remoteTileSource(_ tileSource: Any, tileDidLoad tileID: MaplyTileID)
Parameters
tileSource
the remote tile source that loaded the tile.
tileID
The ID of the tile we loaded.
-
Modify the tile data after it’s been read.
This method is useful for messing with tile sources that may not be images, but can be turned into images.
Declaration
Objective-C
- (nonnull NSData *)remoteTileSource:(id _Nonnull)tileSource modifyTileReturn:(NSData *_Nonnull)tileData forTile:(MaplyTileID)tileID;
Swift
optional func remoteTileSource(_ tileSource: Any, modifyTileReturn tileData: Data, forTile tileID: MaplyTileID) -> Data
-
The tile failed to load.
Declaration
Objective-C
- (void)remoteTileSource:(id _Nonnull)tileSource tileDidNotLoad:(MaplyTileID)tileID error:(NSError *_Nullable)error;
Swift
optional func remoteTileSource(_ tileSource: Any, tileDidNotLoad tileID: MaplyTileID, error: Error?)
Parameters
tileSource
The remote tile source that tried to load the tile.
tileID
The tile ID of the tile that failed to load.
error
The NSError message, probably from the network routine.
-
Called when the tile is disabled.
Declaration
Objective-C
- (void)remoteTileSource:(id _Nonnull)tileSource tileDisabled:(MaplyTileID)tileID;
Swift
optional func remoteTileSource(_ tileSource: Any, tileDisabled tileID: MaplyTileID)
-
Called when the tile is enabled.
Declaration
Objective-C
- (void)remoteTileSource:(id _Nonnull)tileSource tileEnabled:(MaplyTileID)tileID;
Swift
optional func remoteTileSource(_ tileSource: Any, tileEnabled tileID: MaplyTileID)
-
Called when the tile is unloaded.
Normally you won’t get called when an image or vector tile is unloaded from memory. If you set this, you will.
You’re not required to do anything, but you can clean up data of your own if you like.
You will be called on another thread, so act accordingly.
Declaration
Objective-C
- (void)remoteTileSource:(id _Nonnull)tileSource tileUnloaded:(MaplyTileID)tileID;
Swift
optional func remoteTileSource(_ tileSource: Any, tileUnloaded tileID: MaplyTileID)
Parameters
tileID
The tile that that just got unloaded.