We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2da8841 commit 098a96fCopy full SHA for 098a96f
BDKSwiftExampleWallet/View Model/WalletViewModel.swift
@@ -62,12 +62,13 @@ class WalletViewModel {
62
}
63
64
private var updateKyotoProgress: @Sendable (Float) -> Void {
65
- { [weak self] progress in
66
- DispatchQueue.main.async {
67
- self?.progress = progress
68
- let progressPercent = UInt64(progress)
69
- self?.inspectedScripts = progressPercent
70
- self?.totalScripts = 100
+ { [weak self] rawProgress in
+ DispatchQueue.main.async { [weak self] in
+ guard let self else { return }
+ let sanitized = rawProgress.isFinite ? min(max(rawProgress, 0), 100) : 0
+ self.progress = sanitized
+ self.inspectedScripts = UInt64(sanitized)
71
+ self.totalScripts = 100
72
73
74
0 commit comments