Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making canReplaceMapContent settable from outside #43

Merged
merged 2 commits into from
May 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions MapCache/Classes/MKMapView+MapCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ extension MKMapView {
/// Will tell the map to use the cache passed as parameter for getting the tiles.
///
/// - Parameter cache: A cache that implements the `MapCacheProtocol`. Typically an instance of `MapCache`
/// - Parameter canReplaceMapContent: Does the overlay replace the default map? It can be used to add a tile layer with centain level of transparency.
///
/// - SeeAlso: `Readme`
@discardableResult
public func useCache(_ cache: MapCacheProtocol) -> CachedTileOverlay {
public func useCache(_ cache: MapCacheProtocol, canReplaceMapContent: Bool = true) -> CachedTileOverlay {

let tileServerOverlay = CachedTileOverlay(withCache: cache)
tileServerOverlay.canReplaceMapContent = true
tileServerOverlay.canReplaceMapContent = canReplaceMapContent

// Don't set `maximumZ` when wanting "over zooming".
// TileOverlay will stop trying in zoom levels beyond `maximumZ`.
Expand Down