I'm new to iOS development and think it's awesome, BUT I absolutely H A T E everything about NavigationView/NavigationLink, even in Android it's very hard to find such idiocy!
In ContentView I have:
NavigationLink(destination: Login().navigationBarBackButtonHidden(true), label: {
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit).frame(width: 32)
.foregroundColor(Color(UIColor(named: "IconColor")!))
})
And Login():
struct Login: View {
@AppStorage("userid") var userid: Int = 0
var body: some View{
VStack{
HStack{
Spacer()
Button(action: {
// Close the view!!???
}) {
Image(systemName: "xmark")
.resizable()
.frame(width: 18, height: 18)
.foregroundColor(Color(UIColor(named: "IconColor")!))
}
.padding(.top, 12.0)
.padding(.trailing, 16.0)
}
Spacer()
}
}
}
How can I just close the View clicking on the button?