aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Shared/Utils.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp/iosApp/Shared/Utils.swift')
-rw-r--r--iosApp/iosApp/Shared/Utils.swift13
1 files changed, 13 insertions, 0 deletions
diff --git a/iosApp/iosApp/Shared/Utils.swift b/iosApp/iosApp/Shared/Utils.swift
index 625b082..5a06d8f 100644
--- a/iosApp/iosApp/Shared/Utils.swift
+++ b/iosApp/iosApp/Shared/Utils.swift
@@ -17,6 +17,8 @@
*/
import Foundation
import CryptoKit
+import WhirlyGlobeMaplyComponent
+import shared
class Utils {
static func MD5(string: String) -> String {
@@ -25,4 +27,15 @@ class Utils {
String(format: "%02hhx", $0)
}.joined()
}
+
+ static func tileInfoFrom(layer: MapLayer) -> MaplyRemoteTileInfoNew {
+ let cacheDir = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)[0]
+ let thisCacheDir = "\(cacheDir)/\(Utils.MD5(string: layer.url))"
+
+ let tileInfo = MaplyRemoteTileInfoNew(baseURL: layer.url,
+ minZoom: layer.minZoom,
+ maxZoom: layer.maxZoom)
+ tileInfo.cacheDir = thisCacheDir
+ return tileInfo
+ }
}