struct ServicePageView: View {
@ObservedRealmObject var employeeGroup: ServiceModel
Section(header: Text("Select Employees: ")){
List{
ForEach(employeeGroup.employeesList, id: .self){ employee in
Text(employee.firstName)
}
}
}
}
struct ServicePageView_Previews: PreviewProvider {
static var previews: some View {
ServicePageView(employeeGroup: ServiceModel)
}
}
Hello,
Getting an error "Cannot convert value of type ‘ServiceModel.Type’ to expected argument type ‘ServiceModel’" at the ServicePagePreview(employeeGroup: ServiceModel). Am I using the wrong data type?
2
Answers
You are supplying the type here:
ServicePageView(employeeGroup: ServiceModel)
I think you meant to give an instance as in ServiceModel()
which would be an init returning an instance of the type.
you need to wrap your code in a "body" to be a view, like this: