I'm creating more than one textfield according to user's input. When user enters 3 then I will create 3 textfields using foreach loop but I don't know how I can handle inputs that will come from these textFields? also I want to save these inputs to my CoreData.Will I need to use a relationship?
ForEach(0..<Int(homeData.productCount)!, id: \.self){element in RoundedRectangle(cornerRadius: 10) .foregroundColor(Color(.systemGray6)) .overlay( HStack { Image(systemName: "pencil") .resizable() .aspectRatio(contentMode: .fill) .frame(width: 15, height: 15, alignment: .center) .padding(.leading, 20) Spacer() TextField("Product \(element)", text: $myfield) } ).frame(width: UIScreen.main.bounds.width - 35, height: 50, alignment: .leading) }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)