MaplySimpleTileFetcher
Objective-C
@interface MaplySimpleTileFetcher : NSObject <MaplyTileFetcher>
Swift
class MaplySimpleTileFetcher : NSObject, MaplyTileFetcher
Simple Tile Fetcher is meant for sub classing.
Some data sources aren't all that complex. You read from a local source,
you return the data. Something else turns it into visible objects. Simple.
To implement one of those, subclass the Simple Tile Fetcher and let it do the
tricky bits.
-
Your Subclass must call this init method
Declaration
Objective-C
- (nullable instancetype)initWithName:(NSString *_Nonnull)name minZoom:(int)minZoom maxZoom:(int)maxZoom;
Swift
init?(name: String, minZoom: Int32, maxZoom: Int32)
-
The quad paging loader variants need a TileInfo object, even if it’s very simple
Declaration
Objective-C
- (nullable NSObject<MaplyTileInfoNew> *)tileInfo;
Swift
func tileInfo() -> MaplyTileInfoNew?
-
Dispatch queue the data fetcher is doing its work on
Declaration
Objective-C
@property (nonnull) dispatch_queue_t queue;
Swift
var queue: DispatchQueue { get set }
-
Set by default. We won’t every return an error on failing to load. Useful for sparse data sets
Declaration
Objective-C
@property _Bool neverFail;
Swift
var neverFail: Bool { get set }
-
Name used for debugging
Declaration
Objective-C
@property NSString *_Nonnull name;
Swift
var name: String { get set }
-
Min zoom level
Declaration
Objective-C
- (int)minZoom;
Swift
func minZoom() -> Int32
-
Max zoom level
Declaration
Objective-C
- (int)maxZoom;
Swift
func maxZoom() -> Int32
-
Override dataForTile:tileID: to return your own data for a given tile. The fetchInfo can be a custom object (if you set it up that way) or you can just use the tileID argument.
You'll be called on the dispatch queue. You can return either an NSData or a MaplyLoaderReturn
Declaration
Objective-C
- (id _Nullable)dataForTile:(id _Nonnull)fetchInfo tileID:(MaplyTileID)tileID;
Swift
func data(forTile fetchInfo: Any, tileID: MaplyTileID) -> Any?
-
Override the shutdown method.
Call the superclass shutdown method *first* and then run your own shutdown.
Declaration
Objective-C
- (void)shutdown;
Swift
func shutdown()