Skip to content

Commit

Permalink
assert associated cache type
Browse files Browse the repository at this point in the history
  • Loading branch information
watt committed Mar 27, 2023
1 parent 751bea7 commit b41958d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BlueprintUI/Sources/Internal/LayoutTreeNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ final class LayoutTreeNode {
}

func associatedCache<AssociatedCache>(create: () -> AssociatedCache) -> AssociatedCache {
assert(
_associatedCache is AssociatedCache?,
"Expected associated cache of type \(AssociatedCache.self), not \(type(of: _associatedCache))"
)
if let associatedCache = _associatedCache as? AssociatedCache {
return associatedCache
}
Expand Down

0 comments on commit b41958d

Please sign in to comment.