Tickers provides a high level overview of the state of the cryptocurrencies market.
After launch, the overview screen is presented which provides list of cryptocurrencies, where each of the cells is representing one cryptocurrency, containing information such as name of the coin, its price and its 24-hour change in percentages. Data is updated every 5 seconds, providing users with up-to-date information.
The application supports both light and dark appearance as well.
At the top of the screen there is a search bar which enables users to filter coins in order to easily find cryptocurrency they're most interested in.
When data is being loaded, a loading indicator is presented for a better user experience.
Whenever a network connection is lost, a friendly error message is presented at the top of the screen, and whenever the connection is restored, data is being fetched again and continues to be updated each 5 seconds.
Tickers is a native iOS application written in Swift programming language using SwiftUI framework. It is written as a modular monolith, with clear separation of concerns, following Test-Driven Development (TDD).
Since the application has a requirement of updating the data every 5 seconds, Functional Reactive Paradigm (FRP) seemed to be a good approach. SwiftUI with Combine handled frequent UI updates effortlessly.
Architecture that has been implemented is a variation of CLEAN architecture, with Model-View-ViewModel (MVVM) being implemented as the UI architectural design pattern. The Main component creates the TickersListView
and TickersViewModel
as its only dependency, whereas TickersViewModel
has references to TickersRepository
and Reachability
.
TickerRepository
is a protocol, an abstraction of RemoteTickerRepository
which has a reference to HTTPClient
and its responsibility is to fetch data from the API.
However, the API model of
Ticker
namedRemoteTicker
has multiple properties which are not needed for the domain of the application, and thereforeRemoteTickerRepository
mapsRemoteTicker
objects to domain typeTicker
.
URLSessionHTTPClient
belongs to the Infrastructure
layer of the application, and represents an implementation of HTTPClient
protocol which fetches the data from the given URL using URLSession
. Since the URLSessionHTTPClient
is hidden behind an HTTPClient
protocol, the rest of the collaborators do not know about the implementation, and therefore frameworks like Alamofire or Moya could be used instead.
URLSessionHTTPClient
and RemoteTickerRepository
classes have been fully covered with unit tests, gathering coverage of 94%. Following Test-Driven Development and Behavior Driven Design, each of the test functions consists of three parts – Given, When, Then. Test function have been named in form of – test_nameOfTheFunctionBeingTested_expectedBehavior.