SwiftPieChart icon indicating copy to clipboard operation
SwiftPieChart copied to clipboard

value formatter

Open AMBIENTE1 opened this issue 3 years ago • 0 comments

Hi, thank you for your project. Its very nice. Iam trying to change many hours format value to locale "cs_CZ" with currency. Example number 123456.10 to 123 456,10 Kč. Iam sorry, Iam new one in SwiftUI. In swift just use:

` extension Double { var asLocaleCurrency: String { let formatter = NumberFormatter() formatter.numberStyle = .currency formatter.locale = Locale(identifier: "cs_CZ")

    let formattedString = formatter.string(from: self as NSNumber)
    return formattedString ?? ""
}

} let double = 123456.78 print(double.asLocaleCurrency) // 123 456,78 Kč ` but in SwiftUI with your formatter?? Please help!

AMBIENTE1 avatar Nov 29 '21 23:11 AMBIENTE1