mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
FIX: Use numberformatter for properly displaying the wallet balance on widget
This commit is contained in:
parent
d430f53f5d
commit
d603bc222a
1 changed files with 9 additions and 1 deletions
|
@ -35,8 +35,16 @@ struct WalletData {
|
|||
var balance: Double
|
||||
var latestTransactionTime: Int = 0
|
||||
var formattedBalanceBTC: String {
|
||||
let formatter = NumberFormatter()
|
||||
formatter.numberStyle = .none
|
||||
formatter.usesSignificantDigits = true
|
||||
formatter.maximumSignificantDigits = 9
|
||||
let value = NSNumber(value: balance / 100000000);
|
||||
return "\(value.decimalValue) BTC"
|
||||
if let valueString = formatter.string(from: value) {
|
||||
return "\(String(describing: valueString)) BTC"
|
||||
} else {
|
||||
return "0 BTC"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue