'Swift show currency US$ without US

I have the following function to format balance

private func getFormattedBalance(balance: String, currency: String) -> String {
    if let decimal = Decimal(string: balance) {
        let currencyStyle: Decimal.FormatStyle.Currency = .init(code: currency, locale: Locale.current)
        
        return decimal.formatted(currencyStyle)
    }

    return ""
}

The problem is because I am using Locale.current instead of Locale for the currency I am getting US$ instead of just $. How can I get only the $ symbol but keep the current local(not like this Locale(identifier: currency))? enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source