Upvote:1

Aprove answer
// Other code
.onAppear() {
    DispatchQueue.main.async { //<--- Here
        showLoader.toggle()
    }
}
// Other code 

Credit Goes to: stackoverflow.com

Related question with same questions but different answers