-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathUser Location.swift
37 lines (34 loc) · 961 Bytes
/
User Location.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import CoreLocation
import MapLibreSwiftDSL
import SwiftUI
@MainActor
private let locationManager = StaticLocationManager(initialLocation: CLLocation(
coordinate: switzerland,
altitude: 0,
horizontalAccuracy: 1,
verticalAccuracy: 1,
course: 8,
speed: 28,
timestamp: Date()
))
#Preview("Track user location") {
MapView(
styleURL: demoTilesURL,
camera: .constant(.trackUserLocation(zoom: 4, pitch: 45)),
locationManager: locationManager
)
.mapViewContentInset(.init(top: 450, left: 0, bottom: 0, right: 0))
.ignoresSafeArea(.all)
}
#Preview("Track user location with Course") {
MapView(
styleURL: demoTilesURL,
camera: .constant(.trackUserLocationWithCourse(zoom: 4, pitch: 45)),
locationManager: locationManager
)
.mapViewContentInset(.init(top: 450, left: 0, bottom: 0, right: 0))
.mapControls {
LogoView()
}
.ignoresSafeArea(.all)
}