// The capture surface's text rules — pure, no view layer. // // ONE DELIBERATE DIFFERENCE FROM THE TYPESCRIPT, written down because a // silent one is a bug somebody re-introduces: // // • `formatClock` takes INTEGER milliseconds. The phone's `number` admits // `NaN` and a fractional millisecond, and `Int(Double.nan)` does not print // "NaN" in Swift — it traps. A recording timer holds whole milliseconds, so // the type says so and the trap cannot be reached. import CottonKit import Foundation public enum CaptureText { /// `m:ss` for the recording timer and the voice-note pill. Never negative: /// a clock that has not started reads `0:00`, not `-1:00`. public static func formatClock(millis: Int) -> String { let totalSeconds = max(0, millis / 1000) let minutes = totalSeconds / 60 let seconds = totalSeconds % 60 return String(format: "%d:%02d", minutes, seconds) } }