From 4e7cfdffdafac4915d2d08ff1dd945706ffddd6b Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Mon, 6 Oct 2025 20:23:26 +0200 Subject: [PATCH] Fix warnings in MapLibre iOS example app (#3857) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../app-swift/Sources/CustomStyleLayerExample.swift | 11 ++++++++--- .../app-swift/Sources/LocationPrivacyExample.swift | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/ios/app-swift/Sources/CustomStyleLayerExample.swift b/platform/ios/app-swift/Sources/CustomStyleLayerExample.swift index 2c6cb9e34..fdcbe0e2d 100644 --- a/platform/ios/app-swift/Sources/CustomStyleLayerExample.swift +++ b/platform/ios/app-swift/Sources/CustomStyleLayerExample.swift @@ -83,10 +83,15 @@ class CustomStyleLayer: MLNCustomStyleLayer { } """ - var error: NSError? let device = resource.device - let library = try? device?.makeLibrary(source: shaderSource, options: nil) - assert(library != nil, "Error compiling shaders: \(String(describing: error))") + var library: MTLLibrary? = nil + var shaderError: Error? = nil + do { + library = try device?.makeLibrary(source: shaderSource, options: nil) + } catch { + shaderError = error + } + assert(library != nil, "Error compiling shaders: \(String(describing: shaderError))") let vertexFunction = library?.makeFunction(name: "vertexShader") let fragmentFunction = library?.makeFunction(name: "fragmentShader") diff --git a/platform/ios/app-swift/Sources/LocationPrivacyExample.swift b/platform/ios/app-swift/Sources/LocationPrivacyExample.swift index 481bc8985..9aa550550 100644 --- a/platform/ios/app-swift/Sources/LocationPrivacyExample.swift +++ b/platform/ios/app-swift/Sources/LocationPrivacyExample.swift @@ -24,7 +24,7 @@ class PrivacyExampleCoordinator: NSObject, MLNMapViewDelegate { super.init() } - @MainActor func mapView(_: MLNMapView, didChangeLocationManagerAuthorization manager: MLNLocationManager) { + func mapView(_: MLNMapView, didChangeLocationManagerAuthorization manager: MLNLocationManager) { guard let accuracySetting = manager.accuracyAuthorization else { return }