Every time I use NavigationLink the destination parameter needs the struct's objects to be initialized, making unnecessary and messy code.
//View which will send me to another view using NavigationLink()
struct ProfileConfiguration: View {
NavigationLink(destination: ConfigurationCardView(person: Person.init(name: "",
bio: "",
location: ""))
)
}
//The destination view, which has the struct Person:
struct ConfigurationCardView: View {
var person: Person
var body: some View {
//Content
}
}
//The struct Person, with some variables:
struct Person: Hashable, Identifiable {
var name: String
var personImages: [UIImage?] = []
var bio: String
var location: String
}