ios – Conflicting arguments to generic parameter ‘Content material’

0
61


Hi all I am utilizing an array of Enums to create a TextField with a floating label.

Once I go to run my code it offers me an error proper on ForEach(ExamFocusedField.allCases) { subject in }

Conflicting arguments to generic parameter 'Content material' ('<<gap>>' vs. '<<gap>>' vs. '<<gap>>' vs. '<<gap>>')

The place am I doing unsuitable?

enum ExField: Hashable, CaseIterable, Identifiable {
    
    case title, trainer, classRoom
        
    // conforme al protocollo "Identifiable"
    var id: Int {
        change self {
        case .title: return 0
        case .trainer: return 1
        case .classRoom: return 2
        }
    }
    
    var icon: String {
        change self {
        case .title: return "doc.plaintext.fill"
        case .trainer: return "graduationcap.fill"
        case .classRoom: return "door.sliding.proper.hand.open"
        }
    }
    var titleKey: String {
        change self {
        case .title: return "ex1"
        case .trainer: return "ex2"
        case .classRoom: return "ex3"
        }
    }
    
    var floatText: String {
        change self {
        case .title: return "ex4.ex"
        case .trainer: return "ex5.ex"
        case .classRoom: return "ex6.ex"
        }
    }
}

struct ExView: View {
    @Binding var currentIndex: Int
    var measurement: CGSize
    var index: Int
    
    @State non-public var fields: [String] = ["", "", ""]
    @FocusState non-public var centered: ExField?
    
    var physique: some View {
        VStack {
            addTextField()
        }
    }
    
    @ViewBuilder
    func addTextField() -> some View {
        ForEach(ExField.allCases) { subject in
            VStack {
                Textual content(subject.floatText)
                    .font(.comfortaa(.daring, measurement: .physique))
                    .foregroundColor(fields[field.id].isEmpty ? .accentColor : .orange)
                    .scaleEffect(fields[field.id].isEmpty ? 1 : 0.9, anchor: .main)
                    .body(maxWidth: .infinity, alignment: .main)
                    .animation(.interactiveSpring, worth: fields[field.id].isEmpty)
                
                TextField(subject.titleKey, textual content: fields[field.id])
                    .body(peak: 50)
                    .font(.comfortaa(fields[field.id].isEmpty ? .common : .daring, measurement: fields[field.id].isEmpty ? .physique : .headline))
            }
        }
    }
}