I had a view that used to be opened from a list. The view contained a scrollview and all the items are listed in it including the TextFields, Texts, Button, Picker and others. I was using a custom modifier in the toolbar trialing items to show a notification Sheet and a logout button.
Below is the custom code:
ScrollView{
// some code
}.toolbar(){
ToolbarItem(placement: .navigationBarTrailing){
Logout().environmentObject(settings)
}
}
The logout class held the messaging sheet and the logout button. This caused the back button to be disappearing whenever the view loaded. I have now changed it to:
ScrollView{
//some code
}
.navigationBarItems(trailing: Logout().environmentObject(settings))
Topic:
Programming Languages
SubTopic:
Swift
Tags: