I'm also trying to achieve display minutes number only, such as "84"(min, not including "min").
I'm trying to use https://developer.apple.com/documentation/swiftui/text/init(_:format:)-j7xm with customed DiscreteFormatStyle like:
struct CustomFormat: DiscreteFormatStyle {
func discreteInput(before input: Duration) -> Duration? {
input
}
func discreteInput(after input: Duration) -> Duration? {
input
}
func format(_ value: Duration) -> String {
"\(value.components.seconds / 60)"
}
typealias FormatInput = Duration
typealias FormatOutput = String
}
and used as:
Text(.durationOffset(to: start), format: CustomFormat())
It's ok to build and run on main app. However, it won't display as Live Activity component. @Vision Pro Engineer is it a bug? Should I fill a FB?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: