I have one view with MVVM architecture. in view on button click i am calling webService from viewModel class on success i want to dismiss view.
my viewmodel is ObservableObject
i am moving to other screen using navigation and not using sheet
I have tried this
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
`self.presentationMode.wrappedValue.dismiss()`
in view but it will call before API call.
is there any way to dismiss view once i receive API data in viewModel?
Thank you for help