d
This commit is contained in:
@@ -5,6 +5,24 @@ import MicX
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import UIKit
|
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 {
|
struct Content: View {
|
||||||
@State private var selectedId = "1"
|
@State private var selectedId = "1"
|
||||||
var ids = ["1", "2", "3", "4"]
|
var ids = ["1", "2", "3", "4"]
|
||||||
@@ -34,6 +52,7 @@ struct Content: View {
|
|||||||
MicItem.V(selectedId)
|
MicItem.V(selectedId)
|
||||||
Divider()
|
Divider()
|
||||||
.padding()
|
.padding()
|
||||||
|
Now()
|
||||||
List {
|
List {
|
||||||
ForEach(ids, id: \.self) {
|
ForEach(ids, id: \.self) {
|
||||||
Text("\($0): \(val($0))")
|
Text("\($0): \(val($0))")
|
||||||
|
|||||||
Reference in New Issue
Block a user