Hello together,
after a successful write operation to firebase firestore I want to let the user know, that his data was stored. This shall happen in the Navigation Bar (please see picture).
Th green text is managed by a @State property which is set after a successful write operation. The Text appears as intended. But I want to get this text disappear after x seconds with a fade out operation. I tried a couple of solutions with ‘withAnimation’, but didn’t reach the intended result.
Any ideas?
thanks a lot and best regards
Peter
NavigationView {
List {
....
}
}
.navigationTitle("Schedule a Game")
.listStyle(InsetGroupedListStyle()) //GroupedListStyle())
.toolbar {
ToolbarItem(placement: .principal) {
if showResultText {
Text("Game successfully saved")
.foregroundColor(Color("IndiansGreen"))
.fontWeight(.bold)
}
}
}
.navigationBarItems(
leading: HStack {
Button(action: {
tabController.open(.home)
}, label: {Image(systemName: "arrow.backward")})
},
trailing:
HStack {
Button(action: {
}, label: { Text(activateSave ? "Save" : "") })
.alert(isPresented: $showAlert) {
Alert(
title: Text("Warning"),
message: Text("Game already exists in database!"),
dismissButton: .default(Text("Ok"))
)
}
Button(action: {
}, label: {Image(systemName: "trash")})
})
}