Skip to content

Exercise App for fetching Countries infos from rest countries API

License

Notifications You must be signed in to change notification settings

apemaia99/Countries_SwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Countries_SwiftUI

Xcode version 14 Swift Version 5.7

This is a sample Project for fetching data from RestCountries API in Swift & SwiftUI

  • This Application is full written in Swift.
  • UI has been implemented implemented with SwiftUI.
  • Images are downloaded with caching using the new SwiftUI AsyncImage view.
  • The http client for API requests leverage the latest Swift Concurrency Features (Async-Await/Actors) because of that, all async methods can potentially been suspended awaiting results, this implies better reading and reasoning compared to the traditional callbacks.
  • CountryManager is marked with @MainActor this ensure that every model updated runs on the main actor (insted of using DispatchQueue every time) this is mandatory for UI.
  • Network Service in this case is an actor only because we want its work to be done on a different thread instead of using Task.Detached which is not recommended according to the docs.
  • Restcountries is an enum for an easy management of api endpoints.
  • With iOS 16 and SwiftUI 4 the app now support nested navigation trought country borders thanks to NavigationStack.