Number formatting settings, recipe ingredient amount calculation
This commit is contained in:
22
Nextcloud Cookbook iOS Client/Util/NumberFormatter.swift
Normal file
22
Nextcloud Cookbook iOS Client/Util/NumberFormatter.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Locale.swift
|
||||
// Nextcloud Cookbook iOS Client
|
||||
//
|
||||
// Created by Vincent Meilinger on 20.03.24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
// Ingredient number formatting
|
||||
func getNumberFormatter() -> NumberFormatter {
|
||||
let formatter = NumberFormatter()
|
||||
formatter.numberStyle = .decimal
|
||||
formatter.maximumFractionDigits = 2
|
||||
formatter.decimalSeparator = UserSettings.shared.decimalNumberSeparator
|
||||
return formatter
|
||||
}
|
||||
|
||||
let numberFormatter = getNumberFormatter()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user