fix: map tiles being downloaded remotely twice

The url returned by MKTileOverlay.url(forTilePath:) is subsequently used by
MKTileOverlay.loadTile(at:result:) for download. In the case of a tile that
was just cached by OfflineTileManager.persistLocally(path:) we now return
the local file URL to avoid downloading the remote image twice.
This commit is contained in:
Austin Payne 2024-02-03 20:58:23 -07:00 committed by Austin Payne
parent 416d5e5f41
commit ae66e5af59

View file

@ -148,8 +148,9 @@ class OfflineTileManager: ObservableObject {
try data.write(to: filename)
} catch {
print("💀 Save Tile Error = \(error)")
return url
}
return url
return filename
}
private func filterTilesAlreadyExisting(paths: [MKTileOverlayPath]) -> [MKTileOverlayPath] {
paths.filter {