This commit is contained in:
Михаил Капелько
2024-01-06 18:22:22 +03:00
parent a5de0484fd
commit 56512ca26a
3 changed files with 43 additions and 16 deletions

View File

@@ -7,11 +7,18 @@ extension BusUI {
public init(
_ key: String,
_ defaultValue: T
_ defaultValue: T,
_ id: String? = nil
) {
v = defaultValue
var k = key
if let id {
k = k + id
}
Bus.receiveSync(
[key],
[k],
{ [weak self] (_, v: T) in self?.v = v },
&subscriptions
)