This is an sample Crypto market prices ap built with SwiftUI and modularization architecture. The application data is making use of the free APIs provided by Coingecko.
MIT License
33
stars
8
forks
source link
[#39] [Backend] As a user, I can see the chart on the Detail screen #75
Create the new Repository functions and GetChartPricesUseCase along with all the necessary protocols.
Create new models for parsing data with cross-application usage: APIPrices, DataPoint, ChartDataPoint, TimeFilters, etc.
Create a supporting enum - TimeFilter that can help provides different days range for API usage:
1D = 1 day
1W = 7 days
1M = 30 days
1Y = 365 days
5Y = 1285 days (365*5)
Add unit tests for Repository and UseCase layers.
Insight 📝
No major highlights, just reusing the established architecture and adding new UseCase and Repository functions for getting chart data.
There is a small notice that the TimeFilters enum is decided to be placed inside the Domain package instead of the Data package because of our current dependencies setup. The Domain package is currently imported into the Data package so if we implement the enum in Data, it will create a recursive importing cycle - Domain -> Data -> Domain. This will lead to a build failed issue prompted by Xcode. ⚠️
What happened 👀
GetChartPricesUseCase
along with all the necessary protocols.APIPrices
,DataPoint
,ChartDataPoint
,TimeFilters
, etc.TimeFilter
that can help provides different days range for API usage:Insight 📝
No major highlights, just reusing the established architecture and adding new
UseCase
andRepository
functions for getting chart data.There is a small notice that the
TimeFilters
enum is decided to be placed inside theDomain
package instead of theData
package because of our current dependencies setup. TheDomain
package is currently imported into theData
package so if we implement the enum inData
, it will create a recursive importing cycle -Domain -> Data -> Domain
. This will lead to a build failed issue prompted by Xcode. ⚠️Proof Of Work 📹
All tests passed:
Repository layer:
Usecase layer: