diff GeoQuiz/Models/CountryModel.swift @ 6:1946bbfde4af

reformat data structures
author Dennis C. M. <dennis@denniscm.com>
date Thu, 29 Sep 2022 12:00:17 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GeoQuiz/Models/CountryModel.swift	Thu Sep 29 12:00:17 2022 +0200
@@ -0,0 +1,26 @@
+//
+//  CountryModel.swift
+//  GeoQuiz
+//
+//  Created by Dennis Concepción Martín on 29/9/22.
+//
+
+import Foundation
+
+struct CountryModel: Codable {
+    let countries: [String: CountryData]
+    
+    struct CountryData: Codable, Equatable, Hashable {
+        let flag: String
+        let currency: String
+        let population: Int
+        let capital: String
+        
+        static func ==(lhs: CountryData, rhs: CountryData) -> Bool {
+            lhs.flag == rhs.flag &&
+            lhs.currency == rhs.currency &&
+            lhs.population == rhs.population &&
+            lhs.capital == rhs.capital
+        }
+    }
+}