import Foundation struct CapData: Codable { let id: Int var name: String var count: Int var mainImage: Int var color: Cap.Color? enum CodingKeys: String, CodingKey { case id = "i" case name = "n" case count = "c" case mainImage = "m" case color = "f" } } extension CapData: Comparable { static func < (lhs: CapData, rhs: CapData) -> Bool { lhs.id < rhs.id } }