2020/2/16. The Timer with Swift I was suffering about how to use timer with swift… import SwiftUI struct ContentView: View { @State var count = 0 func timerStart() { _ = Timer.scheduledTimer(withTimeInterval: 1, repeats: true , block:{ timer in self .count += 1 }) } var body: some View { VStack{ Button(action:{ self .timerStart()}) { Text("Timer Start") } Text(String(count)) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() ...
Hello. I am Kohei Takagi(髙木 耕平), Japanese. I am World Advisor and Philosopher. “Tomorrow is better day, tomorrow will be better day. Live today hard.” I want to write what I think about the world, on this blog. Thank you for reading my blog!