From 424c12499cab69b935779d306d7d47d19139116e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 11 Jan 2017 08:06:20 -0800 Subject: [ios, macos] Make MGLMapView.style property nullable (#7664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [ios, macos] Made MGLMapView.style property nullable MGLMapView’s style property is now nullable (optional in Swift). The property is set to nil while the style loads and in the event that the style has failed to load. * [ios, macos] Switch to delegate method * [macos] Create MGLMapView programmatically for layer tests When MGLMapView is created via a nib, -initWithCoder: is called, causing styleURL to be set to nil, in turn causing the default Streets style to be loaded, fooling MGLStyleLayerTests into thinking one-line has been loaded. Instead, create MGLMapView programmatically, passing the intended style URL into the initializer, preventing Streets from being loaded. --- platform/darwin/src/MGLRasterStyleLayer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/darwin/src/MGLRasterStyleLayer.h') diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index 54a3149e8c..736e8ee2f5 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN ```swift let layer = MGLRasterStyleLayer(identifier: "clouds", source: source) layer.rasterOpacity = MGLStyleValue(rawValue: 0.5) - mapView.style.addLayer(layer) + mapView.style?.addLayer(layer) ``` */ @interface MGLRasterStyleLayer : MGLForegroundStyleLayer -- cgit v1.2.1