diff GeoQuiz/Models/CountryModel.swift @ 26:425078c01194

refactor code
author Dennis C. M. <dennis@denniscm.com>
date Wed, 09 Nov 2022 10:30:01 +0100
parents GeoQuiz/Logic/CountryModel.swift@f140bb277c96
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GeoQuiz/Models/CountryModel.swift	Wed Nov 09 10:30:01 2022 +0100
@@ -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: Country]
+    
+    struct Country: Codable, Equatable, Hashable {
+        let flag: String
+        let currency: String
+        let population: Int
+        let capital: String
+        
+        static func ==(lhs: Country, rhs: Country) -> Bool {
+            lhs.flag == rhs.flag &&
+            lhs.currency == rhs.currency &&
+            lhs.population == rhs.population &&
+            lhs.capital == rhs.capital
+        }
+    }
+}