importFoundationimportCombine// for `ObservableObject`finalclassModelData:ObservableObject {// โญ๏ธ load initial data from JSON@Publishedvar landmarks: [Landmark] =load("landmarkData.json")}/// โญ๏ธ fetches JSON data from appโs main bundle./// - Returns: an instance of a type conforming to `Decodable`funcload<T:Decodable>(_filename: String) -> T {// prepare to get data from filelet data: Data// get file URL from app's main bundle// 1. filename -> URLguardlet file = Bundle.main.url(forResource: filename, withExtension:nil)else {fatalError("Couldn't find \(filename) in main bundle.") }// 2. URL -> Datado { data =tryData(contentsOf: file) } catch {fatalError("Couldn't load \(filename) from main bundle:\n\(error)") }// 3. Data -> Tdo {let decoder =JSONDecoder()returntry decoder.decode(T.self, from: data) } catch {fatalError("Couldn't parse \(filename) as \(T.self):\n\(error)") }}