lnlink

iOS app for connecting to lightning nodes
git clone git://jb55.com/lnlink
Log | Files | Refs | Submodules | README | LICENSE

commit a11d2e130429439ea9e865c325ade15aef216381
parent 4c2651d242c50bf75cd4c4d2e029d105353eedef
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 31 Mar 2022 08:57:49 -0700

amount_view: just use currency number formatter

otherwise we get weird missing padded 0's like $1.2

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mlightninglink/Views/AmountInputView.swift | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lightninglink/Views/AmountInputView.swift b/lightninglink/Views/AmountInputView.swift @@ -81,9 +81,8 @@ func msats_to_fiat(msats: Int64, xr: ExchangeRate) -> String { let btc = Double(msats) / Double(100_000_000_000) let rate = xr.rate * btc let num_fmt = NumberFormatter() - num_fmt.numberStyle = .decimal - let fmt = num_fmt.string(from: NSNumber(value: round(rate * 100) / 100.0))! - return "$\(fmt)" + num_fmt.numberStyle = .currency + return num_fmt.string(from: NSNumber(value: round(rate * 100) / 100.0))! }