another.im-ios/ConversationsClassic/View/Screens/Attachments/AttachmentLocationPickerView.swift

43 lines
1.4 KiB
Swift
Raw Normal View History

2024-07-04 14:25:25 +00:00
import Combine
2024-07-04 11:45:39 +00:00
import CoreLocation
2024-07-02 09:56:27 +00:00
import MapKit
import SwiftUI
struct AttachmentLocationPickerView: View {
2024-07-04 14:25:25 +00:00
@State var region = MKCoordinateRegion()
@State var userTrackingMode: MapUserTrackingMode = .follow
2024-07-02 09:56:27 +00:00
var body: some View {
2024-07-04 14:25:25 +00:00
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
}
2024-07-04 12:55:47 +00:00
}
}
}
}
2024-07-04 13:40:32 +00:00
}
2024-07-02 09:56:27 +00:00
}
}