Skip to content

Instantly share code, notes, and snippets.

@Rashidium
Created April 21, 2019 21:06
Show Gist options
  • Save Rashidium/2006755dcbefcb9a296f1f85f1b27669 to your computer and use it in GitHub Desktop.
Save Rashidium/2006755dcbefcb9a296f1f85f1b27669 to your computer and use it in GitHub Desktop.
Decodable Coupon struct
import Foundation
struct Coupon: Decodable {
var id: String = ""
var name: String = ""
var no: String = ""
var isOpen: Bool = false
var matches: [PMatches] = [] // PMatches is also a decodable struct.
enum CodingKeys: String, CodingKey {
case id = "cpnid", name = "couponname", no = "couponno", matches, isOpen = "iscouponopen"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment