Skip to content

Commit d32c6c1

Browse files
tatiana-yangithub-actions[bot]
authored andcommitted
[maps_ios] Use TileStore::setRootPath(path) and TileStore::create() instead of deprecated TileStore::create(path). Add setRootPath method to TileStore swift wrapper.
GitOrigin-RevId: 2a27b41199aac57769b932aa88b092cb554386ec
1 parent 5719317 commit d32c6c1

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Mapbox welcomes participation and contributions from everyone.
55
## main
66

77
## 11.23.0-rc.1 - 20 April, 2026
8+
* Use TileStore::setRootPath(path) and TileStore::create() instead of deprecated TileStore::create(path).
9+
* Add setRootPath method to TileStore swift wrapper.
810

911
## 11.20.3 - 14 April, 2026
1012
## 11.22.0 - 16 April, 2026

Sources/MapboxMaps/Offline/TileStore+MapboxMaps.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,25 @@ extension TileStore: TileStoreProtocol {
3030
guard filePathURL.isFileURL else {
3131
fatalError("You must provide a file URL")
3232
}
33-
return TileStore.__create(forPath: filePathURL.path)
33+
// If setRootPathForPath fails because we already have TileStore initialized with the different path,
34+
// we already log error in the native code.
35+
TileStore.__setRootPathForPath(filePathURL.path)
36+
return TileStore.__create()
37+
}
38+
39+
/// Configure the path on disk where tiles and metadata will be stored. This path will be used by create() method as a default location.
40+
/// Method should be invoked before TileStore instance creation. In case TileStore already created with another path method will have no
41+
/// effect and error will be logged.
42+
///
43+
/// If root path was set before to another value, the data from the previous location is not copied.
44+
/// Setting is not persistent.
45+
///
46+
/// - Parameter filePathURL: The path on disk where tiles and metadata will be stored
47+
public static func setRootPath(_ filePathURL: URL) {
48+
guard filePathURL.isFileURL else {
49+
fatalError("You must provide a file URL")
50+
}
51+
TileStore.__setRootPathForPath(filePathURL.path)
3452
}
3553

3654
/// Loads a new tile region or updates the existing one.

0 commit comments

Comments
 (0)