I want to show Products of "group_type" == 1 in CollectionView and Products of "group_type" == 2 in TableView.
I want to populate TableView in order where "group_title" will be Section Header and Products in Array "Products" as Rows. Below is my JSON.
What Swift code do I need?
"product_groups": [
{
"group_title": "Recommended",
"group_type": 1,
"products": [
{
"product_id": 1,
"product_name": "Product 1",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 2,
"product_name": "Product 2",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 3,
"product_name": "Product 3",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 4,
"product_name": "Product 4",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 5,
"product_name": "Product 5",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 6,
"product_name": "Product 6",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
},
{
"product_id": 7,
"product_name": "Product 7",
"product_price": "Rs 1,999/-",
"product_category": "Equipment & Chairs",
"product_image": "https://project-isdental-cammy92.c9users.io/api/images/products/product_1.jpg",
"product_description": "Description 1"
}
]
},
{
"group_title": "Offers",
"group_type": 2,
"products": [
{
"product_id": 8,
"product_name": "Product 8",
"product_price": "Rs 1,999/-",
"product_category": "Materials & Consumables",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 9,
"product_name": "Product 9",
"product_price": "Rs 1,999/-",
"product_category": "Materials & Consumables",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 10,
"product_name": "Product 10",
"product_price": "Rs 1,999/-",
"product_category": "Materials & Consumables",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 11,
"product_name": "Product 11",
"product_price": "Rs 1,999/-",
"product_category": "Materials & Consumables",
"product_image": "",
"product_description": "Description 1"
}
]
},
{
"group_title": "Hot Selling",
"group_type": 2,
"products": [
{
"product_id": 12,
"product_name": "Product 12",
"product_price": "Rs 1,999/-",
"product_category": "Instruments",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 13,
"product_name": "Product 13",
"product_price": "Rs 1,999/-",
"product_category": "Instruments",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 14,
"product_name": "Product 14",
"product_price": "Rs 1,999/-",
"product_category": "Instruments",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 15,
"product_name": "Product 15",
"product_price": "Rs 1,999/-",
"product_category": "Instruments",
"product_image": "",
"product_description": "Description 1"
},
{
"product_id": 16,
"product_name": "Product 16",
"product_price": "Rs 1,999/-",
"product_category": "Instruments",
"product_image": "",
"product_description": "Description 1"
}
]
}