Skip to content

BitTicker is an application help tracking crypto coins prices from different exchanges

Notifications You must be signed in to change notification settings

donjordano/BitTicker

Repository files navigation

BitTicker is an application help tracking crypto coins prices from different exchanges

🚨 Important note 🚨

This project is using cocoapods. Please be sure to run the pod install command before running the project. If you have any doubt about cocoapods you can check the reference here.

🛠 Development tools

  • Swift 4.2
  • Xcode 10.1
  • Cocoapods 1.5.3
  • Minimun iOS version: 12.1

🧰 Third-Party Libraries

  • Starscream: Starscream is a conforming WebSocket (RFC 6455) client library in Swift.
  • Firebase: Firebase is an app development platform with tools to help you build, grow and monetize your app.
  • R.Swift: Get strong typed, autocompleted resources like images, fonts and segues in Swift projects
  • SVProgressHUD: A clean and lightweight progress HUD for your iOS and tvOS app.

🏗 Project Architecture

alt tag

References:

⛩ How did I implement VIPER?

Basically, there is a protocol/contracts file for each scene in the app. This file defines the interaction between each layer as follows:

  • View - Presenter: protocols to notify changes and to inject information to the UI.
  • Presenter - Interactor: protocols to request / receive information to / from the interactor.
  • Presenter - Router: protocol to define the transitions between scenes

Another important point is because using of protocols it's really easy to define mocks views/presenters/interactors/routers for testing.

// View / Presenter
protocol LoginView: class {
    var presenter: LoginPresentation! { get set }
    
    func showLogingView()
    func showTickerView()
    func showAlert(title: String, message: String)
    func showLoaderView(show: Bool)
}

protocol LoginPresentation: class {
    var view: LoginView? { get set }
    var interactor: LoginInteractorInput? { get set }
    var router: LoginWireframe! {  get set }
    
    func didClickLoginButton(withEmail email: String, andPassword password: String)
    func didClickRegisterButton(withEmail email: String, andPassword password: String)
    func showPairsList()
}

// Presenter to interactor
protocol LoginInteractorInput: class {
    var presenter: LoginInteractorOutput? {get set}
    func loginUser(email: String, password: String)
    func registerUser(email: String, password: String)
}

// Interactor to presenter
protocol LoginInteractorOutput: class {
    func succeed()
    func failed(error: String)
}

// Router
protocol LoginWireframe: class {
    var viewController: UIViewController? { get set }
    
    static func assembleModule() -> UIViewController
    func presentPairsList()
    
}

📊 Data models

Data model for this project is very simple. It represent single ticker data structure.

// Entity
struct Ticker {
    var tickerId: String
    var lastPrice: Double
    var lowestAsk: Double
    var higestAsk: Double
    var percent24: Double
    var higestTrade24: Double
    var lowestTrade24: Double
    var isFrozen: Bool
}

📻 Where the data is coming from?

The project is using Poloniex WebSocket, documentation can be found here. The app is using subscribe and unsubscribe methods to ticker updates for all currency pairs.

Subscription example:

{ "command": "subscribe", "channel": 1002 }

Subsequent messages are ticker updates.

[ <id>, null, [ <currency pair id>, "<last trade price>", "<lowest ask>", "<highest bid>", "<percent change in last 24 hours>", "<base currency volume in last 24 hours>", "<quote currency volume in last 24 hours>", <is frozen>, "<highest trade price in last 24 hours>", "<lowest trade price in last 24 hours>" ], ... ]

For example:

[ 1002, null, [ 149, "382.98901522", "381.99755898", "379.41296309", "-0.04312950", "14969820.94951828", "38859.58435407", 0, "412.25844455", "364.56122072" ] ]

💡 Managers

ReachabilityManager

Used to manage the reachability. In this case I would like to notify a little issue related with the simulator. It seems Xcode has an issue with the simulator because if you try to turn off the wifi and turning on again, the observer for the state change is not triggering. It's working 100% fine in a real device

🖌 Design

The assets were create in SketchApp. The .sketch is included in the repository here

How it looks like?

alt tag

👨🏻‍💻 Support && contact

Email

You can contact me using my email: jordanov.ivan@gmai.com

Twitter

Follow me @donjordano on twitter.

About

BitTicker is an application help tracking crypto coins prices from different exchanges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published