specifier / formatter

import SwiftUI
let pi = Double.pi
let str: LocalizedStringKey = "\(pi, specifier: "%.2f")"

Last updated