|
|
@@ -5,6 +5,24 @@ import MicX |
|
|
|
import SwiftUI |
|
|
|
import UIKit |
|
|
|
|
|
|
|
struct Now: View { |
|
|
|
@State var refresh = false |
|
|
|
let tm = Timer.publish(every: 0.5, on: .current, in: .common).autoconnect() |
|
|
|
|
|
|
|
var now: String { |
|
|
|
"Now: " + String(describing: Int(Date().timeIntervalSince1970)) |
|
|
|
} |
|
|
|
|
|
|
|
var body: some View { |
|
|
|
Text(now) |
|
|
|
.onReceive(tm) { _ in |
|
|
|
self.refresh.toggle() |
|
|
|
} |
|
|
|
// Магия для обновления себя. |
|
|
|
.background(Color.clear.disabled(refresh)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
struct Content: View { |
|
|
|
@State private var selectedId = "1" |
|
|
|
var ids = ["1", "2", "3", "4"] |
|
|
@@ -34,6 +52,7 @@ struct Content: View { |
|
|
|
MicItem.V(selectedId) |
|
|
|
Divider() |
|
|
|
.padding() |
|
|
|
Now() |
|
|
|
List { |
|
|
|
ForEach(ids, id: \.self) { |
|
|
|
Text("\($0): \(val($0))") |
|
|
|