Stabilize beta release with warning cleanup and edge-case fixes

This commit is contained in:
Trey t
2026-02-22 13:18:14 -06:00
parent fddea81e36
commit ec2bbb4764
55 changed files with 712 additions and 315 deletions

View File

@@ -429,10 +429,14 @@ struct QuickAddItemSheet: View {
// Restore location if present
if let lat = info.latitude,
let lon = info.longitude {
let placemark = MKPlacemark(
coordinate: CLLocationCoordinate2D(latitude: lat, longitude: lon)
)
let mapItem = MKMapItem(placemark: placemark)
let location = CLLocation(latitude: lat, longitude: lon)
let mapItem: MKMapItem
if #available(iOS 26.0, *) {
mapItem = MKMapItem(location: location, address: nil)
} else {
let placemark = MKPlacemark(coordinate: location.coordinate)
mapItem = MKMapItem(placemark: placemark)
}
mapItem.name = info.title
selectedPlace = mapItem
}
@@ -447,7 +451,7 @@ struct QuickAddItemSheet: View {
if let place = selectedPlace {
// Item with location
let coordinate = place.placemark.coordinate
let coordinate = mapItemCoordinate(for: place)
customInfo = CustomInfo(
title: trimmedTitle,
icon: "\u{1F4CC}",
@@ -489,21 +493,18 @@ struct QuickAddItemSheet: View {
dismiss()
}
private func mapItemCoordinate(for place: MKMapItem) -> CLLocationCoordinate2D {
place.location.coordinate
}
private func formatAddress(for place: MKMapItem) -> String? {
let placemark = place.placemark
var components: [String] = []
if let thoroughfare = placemark.thoroughfare {
components.append(thoroughfare)
if let shortAddress = place.address?.shortAddress, !shortAddress.isEmpty {
return shortAddress
}
if let locality = placemark.locality {
components.append(locality)
if let fullAddress = place.address?.fullAddress, !fullAddress.isEmpty {
return fullAddress
}
if let administrativeArea = placemark.administrativeArea {
components.append(administrativeArea)
}
return components.isEmpty ? nil : components.joined(separator: ", ")
return place.addressRepresentations?.cityWithContext
}
// MARK: - POI Loading