[Solved] Populate CollectionView and TableView using objects at different index of same array [closed]

You can use filter method of array: //this filter will return you all objects whose group type is equal to 1 let collectionArray = (product_groups?.filter({$0.group_type == 1})) //this filter will return you all objects whose group type is equal to 2 let tableArray = (product_groups?.filter({$0.group_type == 2})) For group title to be section header: – … Read more