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