KeyedViewBitmapCache
public class KeyedViewBitmapCache : ViewBitmapCache
A specialization of ViewBitmapCache
that supports storing hashable metadata
that can be used to invalidate the contents of the cache by comparing the
current values with the values present the previous time the cache was rendered.
-
Updates the key for this bitmap cache to be a ordered-set of the given hashable values.
The next time
cachingOrRendering
is invoked, if the contents of the latestupdateKeys
up to before the method is invoked is different from the contents of the last timecachingOrRendering
was invoked, the bitmap cache is invalidated and is re-rendered.Declaration
Swift
public func updateKeys(_ keys: AnyHashable...)
-
Performs a deferred rendering operation that either redraws the cache bitmap if it’s been invalidated through
closure
and then draws it onrenderer
, or if a cached bitmap is already present, draws the cached bitmap torenderer
and skips invokingclosure
.If the latest
updateKeys
invocation does not match the keys present when the lastcachingOrRendering
call was made, the contents of the cache are erased and re-rendered.Declaration
Swift
public override func cachingOrRendering( _ renderer: any Renderer, _ closure: (any Renderer) -> Void )