d
This commit is contained in:
@@ -3,9 +3,12 @@ import SwiftUI
|
|||||||
|
|
||||||
extension MicItem {
|
extension MicItem {
|
||||||
public struct V: View {
|
public struct V: View {
|
||||||
|
var id: String?
|
||||||
@StateObject var isActive = BusUI.Value(Mic.K.isActive, false)
|
@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) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
||||||
Bus.send(Mic.K.isActive, true)
|
Bus.send(Mic.K.isActive, true)
|
||||||
}
|
}
|
||||||
@@ -22,6 +25,12 @@ extension MicItem {
|
|||||||
width: isActive.v ? 3 : 1
|
width: isActive.v ? 3 : 1
|
||||||
)
|
)
|
||||||
.animation(.easeInOut(duration: 0.3))
|
.animation(.easeInOut(duration: 0.3))
|
||||||
|
.onAppear {
|
||||||
|
isActive.id = id
|
||||||
|
}
|
||||||
|
.onChange(of: id) { newValue in
|
||||||
|
isActive.id = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user