43 lines
1.4 KiB
Swift
43 lines
1.4 KiB
Swift
import Combine
|
|
import CoreLocation
|
|
import MapKit
|
|
import SwiftUI
|
|
|
|
struct AttachmentLocationPickerView: View {
|
|
@State var region = MKCoordinateRegion()
|
|
@State var userTrackingMode: MapUserTrackingMode = .follow
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
Map(
|
|
coordinateRegion: $region,
|
|
interactionModes: .all,
|
|
showsUserLocation: false,
|
|
userTrackingMode: $userTrackingMode
|
|
)
|
|
.overlay {
|
|
Image(systemName: "mappin")
|
|
.resizable()
|
|
.frame(width: 30, height: 30)
|
|
.foregroundColor(.Material.Elements.active)
|
|
if userTrackingMode != .follow {
|
|
VStack {
|
|
Spacer()
|
|
HStack {
|
|
Spacer()
|
|
Image(systemName: "location.north.circle.fill")
|
|
.resizable()
|
|
.frame(width: 30, height: 30)
|
|
.foregroundColor(.Material.Elements.active)
|
|
.padding()
|
|
.tappablePadding(.symmetric(10)) {
|
|
userTrackingMode = .follow
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|