Fixed that executeMutatingMethod() got executed on each view update
This commit is contained in:
parent
3be297c0d3
commit
b5756c909f
|
@ -47,6 +47,8 @@ struct AccountTransactionsDialog: View {
|
||||||
|
|
||||||
@State private var errorMessage: Message? = nil
|
@State private var errorMessage: Message? = nil
|
||||||
|
|
||||||
|
@State private var isInitialized = false
|
||||||
|
|
||||||
|
|
||||||
@Inject private var presenter: BankingPresenterSwift
|
@Inject private var presenter: BankingPresenterSwift
|
||||||
|
|
||||||
|
@ -142,8 +144,12 @@ struct AccountTransactionsDialog: View {
|
||||||
.systemGroupedBackground()
|
.systemGroupedBackground()
|
||||||
}
|
}
|
||||||
.executeMutatingMethod {
|
.executeMutatingMethod {
|
||||||
|
if isInitialized == false {
|
||||||
|
isInitialized = true
|
||||||
|
|
||||||
self.setInitialValues()
|
self.setInitialValues()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.alert(message: $errorMessage)
|
.alert(message: $errorMessage)
|
||||||
.showNavigationBarTitle(LocalizedStringKey(title))
|
.showNavigationBarTitle(LocalizedStringKey(title))
|
||||||
.navigationBarItems(trailing: UpdateButton { _, executingDone in self.updateTransactions(executingDone) })
|
.navigationBarItems(trailing: UpdateButton { _, executingDone in self.updateTransactions(executingDone) })
|
||||||
|
|
|
@ -72,6 +72,9 @@ struct FlickerCodeTanView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@State private var isInitialized = false
|
||||||
|
|
||||||
|
|
||||||
init(_ tanChallenge: BankingUiSwift.FlickerCodeTanChallenge) {
|
init(_ tanChallenge: BankingUiSwift.FlickerCodeTanChallenge) {
|
||||||
self.tanChallenge = tanChallenge
|
self.tanChallenge = tanChallenge
|
||||||
|
|
||||||
|
@ -149,11 +152,15 @@ struct FlickerCodeTanView: View {
|
||||||
}
|
}
|
||||||
// what a hack to be able to call animator.animate() (otherwise compiler would throw 'use of immutable self in closure' error)
|
// what a hack to be able to call animator.animate() (otherwise compiler would throw 'use of immutable self in closure' error)
|
||||||
.executeMutatingMethod {
|
.executeMutatingMethod {
|
||||||
|
if isInitialized == false {
|
||||||
|
isInitialized = true
|
||||||
|
|
||||||
self.calculateStripeWidth()
|
self.calculateStripeWidth()
|
||||||
|
|
||||||
self.animator.animate(self.tanChallenge.flickerCode.parsedDataSet, self.showStep)
|
self.animator.animate(self.tanChallenge.flickerCode.parsedDataSet, self.showStep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private func showStep(_ step: Step) {
|
private func showStep(_ step: Step) {
|
||||||
|
|
Loading…
Reference in New Issue