Post

Replies

Boosts

Views

Activity

Updating Time - SwiftUI
Hello! I am wanting to have the current time updating in SwiftUI I want to embed this in another view. After scouring the internet, this is what I've managed to put together so far. Here's where I've got so far: struct Time : View {     static let timeFormatter: DateFormatter = {         let formatter = DateFormatter()         formatter.dateStyle = .none         formatter.timeStyle = .medium         return formatter     }()     var now = Date()     @State var timer: Timer     @State var repeater: Bool = true     var body: some View {             Text("\(now, formatter: Self.timeFormatter)")         }     } } I don't have loads of experience – any and all help is appreciated, and I thank-you all for your time.
10
0
9.1k
Aug ’20