blob: 4d35dfece9ec36482db98f5abf7c43e24070dfd2 (
plain) (
blame)
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
38
39
40
41
42
43
44
45
|
//
// ContentView.swift
// Hæ-appen
//
// Created by Ivar Løvlie on 16/09/2025.
//
import SwiftUI
import MapKit
struct MapContentView: View {
@Namespace var mapScope
@State private var position: MapCameraPosition = .automatic
var annotationStringKey: LocalizedStringKey = "Annotation"
var annotationCoordinate: CLLocationCoordinate2D = CLLocationCoordinate2D.init()
let symbolSet: [String] = ["cloud.bolt.rain.fill", "sun.rain.fill", "moon.stars.fill", "moon.fill"]
var body: some View {
if #available(iOS 26, *) {
VStack {
Map(initialPosition: .userLocation(fallback: position), scope: mapScope)
}.safeAreaInset(edge: .trailing) {
GlassEffectContainer(spacing: 10.0) {
HStack(spacing: 20.0) {
ForEach(symbolSet.indices, id: \.self) { item in
Image(systemName: symbolSet[item])
.frame(width: 80.0, height: 80.0)
.font(.system(size: 36))
.glassEffect()
.glassEffectUnion(id: item < 2 ? "1" : "2", namespace: mapScope)
}
}
}
}.mapScope(mapScope)
.task {
LocationAuthorizer.shared.requestWhenInUse()
}
}
}
}
#Preview {
MapContentView()
}
|