I will briefly explain my view. My goal is to make a list where you can enter all personal information like a kind of emergency passport. There should also be text fields where you can tap on the plus button and then there is a new text field. On the top right I want to make an edit button that you can delete text fields again. I will connect this view with another SwiftUI view file. Does anyone have an idea how to solve this problem with the list?
import SwiftUI
struct ListeDaten: Identifiable {
let id = UUID()
let Name: String
let Adresse: String
var Telefonnummern: [String] = []
var Something: String = ""
}
struct ListeDaten: View {
var body: some View {
TextField(Name: "Name/Vorname")
TextField(Adresse: "Adresse")
ForEach(id: \.self) {Telefonnummern in TextField("Telefonnummer")}
Button(action: {
Telefonnummern.append("")
})
{
Image(systemName: "plus.circle.fill")
.foregroundColor(Color(.systemGreen))
}
}
}
struct ListeDaten_Previews: PreviewProvider {
static var previews: some View {
ListeDaten()
}
}