-
Fetch a list of countries in JSON format from this URL: https://gist.githubusercontent.com/peymano-wmt/32dcb892b06648910ddd40406e37fdab/raw/db25946fd77c5873b0303b858e861ce724e0dcd0/countries.json
-
Display all the countries in a UITableView ordered by the position they appear in the JSON. In each table cell, show the country's "name", "region", "code" and "capital" in this format:
-
The user should be able to scroll thru the entire list of countries.
-
Use a
UISearchControllerto enable filtering by"name"or"capital"as the user types each character of their search. -
The implementation should be robust (i.e.,
handle errors and edge cases), supportDynamic Type,supportiPhone and iPad, and supportdevice rotation. -
Please use
UIKit, not SwiftUI, for this exercise.
The solution was build for both the UIKit and SwiftUI
// UIKit
window.rootViewController = UINavigationController(rootViewController: CountryViewController(viewModel: CountryViewModel()))
// SwiftUI
//let contentView = UIHostingController(rootView: CountryView(viewModel: CountryViewModel()))
//window.rootViewController = contentViewClean architecture pattern emphasizes the sepration of concertns between different layers to create an application structure that is isolated, testable and easy to maintain.
| Development Aspect | Tech |
|---|---|
| Modularity | Swift Package Manager |
| Multi Threading | swift async-await |
| Design Pattern | MVVM |
| Depedency Injection | Dependencies https://github.com/pointfreeco/swift-dependencies - @Dependency |
| Networking | URLSession |
| Json Mapping | Decodable |
| View | UIKit - UITableView |
| Tests | XCTest |
In this propject i have used the Modular, Clean Architecture, with MVVM design patterns. The app supports iPhone - Portrait and Landscape, iPad - All orientation | Dynamic Type | Light and Dark mode
I have done a detailed explanation of this architecture in my personal github link Clean Architecture