/Tickers

Tickers is a native iOS application, written in Swift programming language using SwiftUI framework.

Primary LanguageSwift

Tickers

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.

drawing drawing

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.

drawing drawing

When data is being loaded, a loading indicator is presented for a better user experience.

drawing drawing

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.

drawing drawing

Technical Side of Things

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 named RemoteTicker has multiple properties which are not needed for the domain of the application, and therefore RemoteTickerRepository maps RemoteTicker objects to domain type Ticker.

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.

drawing

Unit Tests

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.