Authored by Justin R. Miller

another MBTiles convenience method

... ... @@ -50,6 +50,9 @@
/** @name Creating Tile Sources */
/** Initialize and return a newly allocated MBTiles tile source based on a given bundle resource with the extension `.mbtiles`. */
- (id)initWithTileSetResource:(NSString *)name;
/** Initialize and return a newly allocated MBTiles tile source based on a given bundle resource.
* @param name The name of the resource file. If name is an empty string or `nil`, uses the first file encountered of the supplied type.
* @param extension If extension is an empty string or `nil`, the extension is assumed not to exist and the file is the first file encountered that exactly matches name. */
... ...
... ... @@ -46,6 +46,11 @@
@synthesize cacheable = _cacheable, opaque = _opaque;
- (id)initWithTileSetResource:(NSString *)name
{
return [self initWithTileSetResource:name ofType:([[[name pathExtension] lowercaseString] isEqualToString:@"mbtiles"] ? @"" : @"mbtiles")];
}
- (id)initWithTileSetResource:(NSString *)name ofType:(NSString *)extension
{
return [self initWithTileSetURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:name ofType:extension]]];
... ...