diff options
Diffstat (limited to 'platform/ios/MGLMapView.mm')
-rw-r--r-- | platform/ios/MGLMapView.mm | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index a959bce7bf..a517a4d26f 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -114,41 +114,32 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) - (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - - if (self && [self commonInit]) + if (self = [super initWithFrame:frame]) { + [self commonInit]; self.styleURL = nil; - return self; } - - return nil; + return self; } - (instancetype)initWithFrame:(CGRect)frame styleURL:(NSURL *)styleURL { - self = [super initWithFrame:frame]; - - if (self && [self commonInit]) + if (self = [super initWithFrame:frame]) { + [self commonInit]; self.styleURL = styleURL; - return self; } - - return nil; + return self; } - (instancetype)initWithCoder:(NSCoder *)decoder { - self = [super initWithCoder:decoder]; - - if (self && [self commonInit]) + if (self = [super initWithCoder:decoder]) { + [self commonInit]; self.styleURL = nil; - return self; } - - return nil; + return self; } - (NSString *)accessToken @@ -193,20 +184,14 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) _mbglMap->setStyleURL([[styleURL absoluteString] UTF8String]); } -- (BOOL)commonInit +- (void)commonInit { _isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent; // create context // _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - - if ( ! _context) - { - mbgl::Log::Error(mbgl::Event::Setup, "failed to create OpenGL ES context"); - - return NO; - } + NSAssert(_context, @"Failed to create OpenGL ES context."); // setup accessibility // @@ -394,8 +379,6 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) MGLEventKeyZoomLevel: @(zoom), MGLEventKeyPushEnabled: @([MGLMapboxEvents checkPushEnabled]) }]; - - return YES; } -(void)reachabilityChanged:(NSNotification*)notification |