Skip to content

Commit ebbb17a

Browse files
authored
Update FluidViewIdentifier (#164)
1 parent 3f68cad commit ebbb17a

File tree

2 files changed

+54
-7
lines changed

2 files changed

+54
-7
lines changed

Package.resolved

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/FluidStack/Helper/UIView+.swift

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,28 @@ extension UIView {
109109
}
110110

111111
public struct FluidViewIdentifier: Hashable {
112-
113-
public var rawIdentifier: String
114-
112+
113+
public enum Base: Hashable {
114+
case string(String)
115+
case any(AnyHashable)
116+
}
117+
118+
public private(set) var bases: Set<Base>
119+
115120
public init(_ raw: String) {
116-
self.rawIdentifier = raw
121+
self.bases = .init(arrayLiteral: .string(raw))
117122
}
118123

119-
public func combined(_ raw: String) -> Self {
120-
return .init("\(rawIdentifier)|\(raw)")
124+
public init(_ object: some Hashable) {
125+
self.bases = .init(arrayLiteral: .any(object))
126+
}
127+
128+
private init(bases: Set<Base>) {
129+
self.bases = bases
121130
}
122-
}
123131

132+
public consuming func combined(_ other: FluidViewIdentifier) -> Self {
133+
self.bases = bases.union(other.bases)
134+
return self
135+
}
136+
}

0 commit comments

Comments
 (0)