I am facing a problem when passing params to a custom view what could be the exact problem over here
struct DescriptionInputView: View {
@ObservedObject var viewModel: ContentViewModel
@State private var description: String = ""
var title: String
var audioRequired: Bool
var videoRequired: Bool
var imageRequired: Bool
var documentRequired: Bool
var body: some View {
VStack(alignment: .leading) {
// Label
Text(title)
.font(.headline)
.padding(.bottom, 5)
Spacer()
if audioRequired || videoRequired || imageRequired || documentRequired {
AttachmentView(viewModel: viewModel )
}
// TextField with underline
VStack {
TextField(title, text: $description)
.keyboardType(.default) // Default keyboard for text input
.padding(.vertical, 10) // Padding for the text
.overlay(Rectangle().frame(height: 1).padding(.top, 35)) // Line below the TextField
.foregroundColor(.gray) // Text color
}
// Character limit hint
Text("Minimum 1 - Maximum 100 characters allowed")
.font(.caption)
.foregroundColor(.gray)
Spacer()
}
.padding()
}
}
var items: [CRItemModel]
@ObservedObject var viewModel: ContentViewModel
...
ForEach(items, id: .id) { item in
switch item.getType().rawValue {
case "TEXT":
DescriptionInputView(
viewModel: viewModel, title: item.title,
audioRequired: item.audioRequired,
videoRequired: item.videoRequired,
imageRequired: item.imageRequired,
documentRequired: item.documentRequired
)
.....
I am getting error in my ForEach DescriptionInputView of AccessibilityRotorContent what could be the problem? thanks ahead!