Jun 10, 2024
JSON used:
[
{
"id": 1,
"name": "Laptop",
"price": 999.99,
"description": "A high-performance laptop."
},
{
"id": 2,
"name": "Smartphone",
"price": 499.99,
"description": "A latest generation smartphone."
},
{
"id": 3,
"name": "Headphones",
"price": 199.99,
"description": "Noise-cancelling over-ear headphones."
}
]
// Product Model
struct Product: Codable {
let id: Int
let name: String
let price: Double
let description: String
}