Any explanation for this error? Thank you

You're inside one of View.body function. SwiftUI is gathering data to display your view. You shouldn't update data, especially @State during this time, it will cause unexpected result.

Instead, use one of event handlers like onAppearInput and Events.

Thanks for your quick response