mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
8753fe3980
Second step towards loading MapLibre on demand: everything that touches it now lives in one framework, so that framework can later be left unlinked. The interactive map view, its annotation view and the coordinate animator move into MapLibreShim, which reaches the app through MapLibreShimProtocol. The app side keeps its MapLibreMapView call site and becomes a thin wrapper that builds a MapViewConfiguration, passing the app-only pieces (map style URLs, marker views, tint colour) across as closures so the shim needs nothing from the app. LocationAnnotation loses its MapLibre conformance and becomes a plain struct, with the shim mapping it onto its own annotation type. MapLibre's log forwarding moves into the shim as well, since TargetConfiguration can no longer reach it.
20 lines
789 B
Swift
20 lines
789 B
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// Implemented by MapLibreShim's entry point, which the app instantiates after
|
|
/// `dlopen`-ing the framework.
|
|
public protocol MapLibreShimProtocol {
|
|
/// Routes MapLibre's logs into the app's logger. Call once after loading the shim.
|
|
func configureLogging(_ handler: @escaping @Sendable (MapLogSeverity, String) -> Void)
|
|
|
|
/// Builds the interactive map view. The app-side `MapLibreMapView` forwards every
|
|
/// body evaluation here so SwiftUI updates flow through to the underlying map.
|
|
func makeMapView(configuration: MapViewConfiguration) -> AnyView
|
|
}
|