From 273298e4c9e564a01f31a4af13027c3d9a72a135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 16 Jan 2024 18:51:18 +0300 Subject: [PATCH] d --- Modules/MicX/MicItem/src/MicItem.V.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/MicX/MicItem/src/MicItem.V.swift b/Modules/MicX/MicItem/src/MicItem.V.swift index 7406eea..5e80ffa 100644 --- a/Modules/MicX/MicItem/src/MicItem.V.swift +++ b/Modules/MicX/MicItem/src/MicItem.V.swift @@ -3,9 +3,12 @@ import SwiftUI extension MicItem { public struct V: View { + var id: String? @StateObject var isActive = BusUI.Value(Mic.K.isActive, false) - public init() { + public init(_ id: String? = nil) { + self.id = id + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { Bus.send(Mic.K.isActive, true) } @@ -22,6 +25,12 @@ extension MicItem { width: isActive.v ? 3 : 1 ) .animation(.easeInOut(duration: 0.3)) + .onAppear { + isActive.id = id + } + .onChange(of: id) { newValue in + isActive.id = newValue + } } } }