I have an instance of a class, which i want to use like a dictionary as datasource for a tableView. here is the instance AlimentTest:
class AlimentModificationData {
static var AlimentTest : AlimentObject = AlimentObject(nomAliment: "Amandes", poids: 100, calories: 108, proteines: 21, lipides: 53, glucides: 8, aRetinol: 8, aBetacarotene: 1, vitamineC: 0.8, vitamineB1: 0.18, calcium: 248, omega3: 0.06, comments: "fffffff sdsddsdsd", premierBooleen: false, optimize: false)
static var listNutriments : [String] = ["aRetinol", "aBetacarotene", "vitamineC", "vitamineB1", "calcium", "omega3"]
}
I want to use this instance "AlimentTest" for a tableView, with a customcell with an identifier. But i want to use only the keys which are specified in the static array named listNutriments.
At the end, i want my tableView to display something like this for dequeureusableCell:
aRetinol 8
aBetacarotene 1
vitamineC 0.8
vitamineB1 0.18
calcium 248
omega3 0.06
How can i do that?