I have an object which has properties and I want to display each property as tableview row. How should I prepare my datasource
For eg:
struct Car {
var make: String
var model: String
var year: String
var vin: String
}
let ford = Car(make: Ford, model: Mustang, year: 2018, vin: 1234)
Now in my tableview i need to display like below i.e., each property as a table row cell
How do I prepare my data source?
I understand that I need to add this to array with propertyname: value like
["make":"Ford", "model":"Mustang", ...]
but how can i do that and how can i parse it to display in my cellForRow method.
Please advice
This is just sample. In my actual struct I have more than 20 properties and each needs to be display in table row. So wanted this to be in tableview