Well, as you have properly guessed, this tiny code has only the benefit of showing the issue.
In my app, I'm actually working with a function that can take up to 1-2 seconds max.
The thing is that when I remove only the modifier .disabled(...), this issue vanishes.
Before posting this topic, I tried many things and when I finally got this tiny reproducible issue code, I then tried to work with DispatchQueue.main.async {...} to avoid the trap my code was driving me on.
My View is build like this:
private var isLoading: Bool {
!isInitialized || isWorking
}
var body: some View {
ZStack {
VStack {
Grid {
GridRow {
...
Button {
Task { await requestPermission() }
} label: { ... }
}
GridRow { ... }
}
}
.disabled(isLoading)
....
if isLoading {
ProgressView()
}
}
}
where isInitialized is handled in the parent and isWorking is handled locally like this:
private func requestPermission() async {
isWorking = true
defer { isWorking = false }
...
}
But as far as the tiny code is able to reproduce the warnings, and most importantly as I'm still learning about Swift, I need support from stronger skills than mine.