I am new to Swift and I'm trying to creat a mobile app for my woocommerce store. I created a product class with name, price and image src. I also created another productBank to store my product objects but I don't know how to populate it with JSON using Alamofire.
class Simpleproduct {
var productName: String
var productPrice: Int
var ProductImage: String
init(price: Int, name: String, image: String) {
productName = name
productPrice = price
ProductImage = image
}
}
class Productbank {
var productlist = [Simpleproduct]()
init() {
productlist.append(Simpleproduct(price: 5, name: "productname", image: "imagesrc"))
productlist.append(Simpleproduct(price: 5, name: "productname", image: "imagesrc"))
productlist.append(Simpleproduct(price: 5, name: "productname", image: "imagesrc"))
productlist.append(Simpleproduct(price: 5, name: "productname", image: "imagesrc"))
// [...]