This project is following the great and free course SwiftUI Crypto App by @SwiftfulThinking. I can not thank him enought for such a great course.
We are using Core Data, SwiftUI, Combine and others great tools. I added new features covering and using Clean Architecture, Mappers, Localization, SwiftLint and Unit Tests.
Demo Dark Mode | Demo Light Mode | Full Demo |
---|---|---|
The project has the following structure:
|
Using Free CoinGecko API for this project. The free plan has a limitations:
The rate limit is ~30 calls per minutes and it varies depending on the traffic size.
So sometimes to avoid this and be able to use the preview I stored the JSON response of the API calls so I can test the service calls like a fake response, and then only use the real API call when I build the app.
URL BASE: https://api.coingecko.com/api/v3/
GET coins/markets?vs_currency=usd&order-market_cap_desc&per_page=100&page=1&sparkline=true&price_change_percentage=24h
GET coins/{coinId}?localization=false&tickers=false&market_data=false&community_data=false&developer_data=false&sparkline=false
GET global
Service | JSON Response File |
---|---|
Get Coins Data | marketsResponse.json |
Get Coin Detail | bitcoinDetailResponse.json |
Get Coin Detail | marketDataResponse.json |
If we exceed the rate limite, we can do like this in CoinDetailDataService
:
Comment the line with dowlonad function:
// coinDetailsSubscription = networkingManager.download(url: url)
And uncomment the next like using the json file:
coinDetailsSubscription = networkingManager.readLocalJSON(nameFile: "bitcoinDetailResponse")
- SparklineDtoMapperTest
- CoinDtoMapperTest
- CoinModelTest
XCode Version 15.4 (15F31d)
macOS 14.5 (23F79)
- Jordan Rojas (@nowjordanhappy)
MIT License
Copyright (c) 2024 Jordan R. A.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.