Stabilize beta release with warning cleanup and edge-case fixes
This commit is contained in:
@@ -7,7 +7,7 @@ import Foundation
|
||||
import CoreLocation
|
||||
import MapKit
|
||||
|
||||
extension MKPolyline: @unchecked Sendable {}
|
||||
extension MKPolyline: @retroactive @unchecked Sendable {}
|
||||
|
||||
actor LocationService {
|
||||
static let shared = LocationService()
|
||||
@@ -80,22 +80,29 @@ actor LocationService {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS, deprecated: 26.0, message: "Uses placemark for address formatting")
|
||||
private func formatMapItem(_ item: MKMapItem) -> String {
|
||||
var components: [String] = []
|
||||
if let locality = item.placemark.locality {
|
||||
components.append(locality)
|
||||
|
||||
if let cityContext = item.addressRepresentations?.cityWithContext,
|
||||
!cityContext.isEmpty {
|
||||
components.append(cityContext)
|
||||
}
|
||||
if let state = item.placemark.administrativeArea {
|
||||
components.append(state)
|
||||
if let regionName = item.addressRepresentations?.regionName,
|
||||
regionName != "United States" {
|
||||
components.append(regionName)
|
||||
}
|
||||
if let country = item.placemark.country, country != "United States" {
|
||||
components.append(country)
|
||||
|
||||
if !components.isEmpty {
|
||||
return components.joined(separator: ", ")
|
||||
}
|
||||
if components.isEmpty {
|
||||
return item.name ?? ""
|
||||
|
||||
if let shortAddress = item.address?.shortAddress, !shortAddress.isEmpty {
|
||||
return shortAddress
|
||||
}
|
||||
return components.joined(separator: ", ")
|
||||
if let fullAddress = item.address?.fullAddress, !fullAddress.isEmpty {
|
||||
return fullAddress
|
||||
}
|
||||
return item.name ?? ""
|
||||
}
|
||||
|
||||
// MARK: - Distance Calculations
|
||||
@@ -163,7 +170,7 @@ actor LocationService {
|
||||
struct RouteInfo: Sendable {
|
||||
let distance: CLLocationDistance // meters
|
||||
let expectedTravelTime: TimeInterval // seconds
|
||||
nonisolated(unsafe) let polyline: MKPolyline?
|
||||
let polyline: MKPolyline?
|
||||
|
||||
var distanceMiles: Double { distance * 0.000621371 }
|
||||
var travelTimeHours: Double { expectedTravelTime / 3600.0 }
|
||||
|
||||
Reference in New Issue
Block a user