I'm new to learning Swift myself. Tell me how to create an object data model? Content is such - there is a list of students by classes, and there are several such classes. These data should be displayed in two tables - in one list of classes, in the other - the user selects a class and the list of students is shown to him.
Made this model:
struct Student { var name: String } struct CollegeClass { var title: String var students: [Student] } var collegeClass = CollegeClass(title: "9A", students: ["Ivanov", "Petrov", "Sidorov"]) But it gives an error - Cannot convert the value of type 'String' to the expected element type 'Student' What is wrong here? How to create a dictionary, then to transfer data from it to a table?
Update: add secondClass
arrayCollegeClass.append(CollegeClass(title: "9B", students: [Student(name: "Orlov"), Student(name: "Pavlov"), Student(name: "Semenov")]))