swiftui-text

SwiftUI change output format of `Text` using as `.timer`

♀尐吖头ヾ 提交于 2020-12-04 08:42:57
问题 Is there a way to change the output format of a Text using init(_ date: Date, style: Text.DateStyle) ? Using a .timer , the output is like: 0:42 , but I want something like 00:00:42 . Background I want to create a widget (iOS 14) where a timer is running, and as I think it's not a good idea to trigger a widget update every second, and this may even also not work reliably, at least that's not how widget are indented to be used. So I thought about using this predefined timer functionality of