Skip to content

Giorgi217/CryptoCoin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

96 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CryptoCoin App

Crypto Portfolio Tracker is a demo iOS application designed to help users manage their cryptocurrency investments. The app provides real-time updates on portfolio value, coin prices, and investment performance. It integrates with Firebase for authentication and Firestore for data storage and uses the CoinGecko API to fetch cryptocurrency data.


๐Ÿš€ Features

  • User Authentication: Secure login and registration using Firebase Authentication.
  • Portfolio Management: Track your total portfolio value (invested balance + investment balance).
  • Real-Time Data: Fetch and display real-time cryptocurrency prices and trends using the CoinGecko API.
  • Coin Search: Search for coins and save your favorite ones using UserDefaults.
  • Buy/Sell Coins: Simulate buying and selling cryptocurrencies with dummy card balances.
  • Charts: View detailed price history charts for each coin (1 day, 1 week, 1 month, 1 year).
  • Trending and Recommended Coins: Discover trending and recommended coins via collection views.
  • Investment Overview: View your holdings, total invested value, and percentage changes in real time.
  • Caching: Optimized API usage with a shared networking layer and response caching to avoid exceeding API rate limits.
  • Image Caching: Uses FileManager to store images locally, reducing redundant downloads and improving performance.

๐Ÿ“Š Main Portfolio View


๐Ÿ“Œ Coin Details


๐Ÿ”Ž Search Coins


๐Ÿ’ฐ Buy/Sell


๐Ÿฆ Deposit/Withdraw


๐Ÿ—๏ธ Architecture

The app follows the MVVM (Model-View-ViewModel) architecture, ensuring a clean separation of concerns and a maintainable codebase.

๐Ÿ›  Model

  • Represents the data structure and business logic of the app.
  • Examples include:
    • Coin: Represents cryptocurrency data fetched from the CoinGecko API.
    • Portfolio: Tracks the user's investment portfolio.
    • User: Stores user-related data, such as authentication details and preferences.

๐Ÿ–ฅ๏ธ View

  • Responsible for displaying the UI and handling user interactions.
  • The app uses a combination of SwiftUI and UIKit:
    • SwiftUI: Modern, declarative UI components (e.g., charts, grids, buttons).
    • UIKit: Used for components like UITableView and UICollectionView where UIKit provides more flexibility.
  • Reusable Components: Custom collection views, table view cells, and custom buttons ensure consistency and reduce code duplication.

๐Ÿง  ViewModel

  • Acts as the intermediary between the Model and View. It handles:
    • Business logic (e.g., validating transactions, calculating portfolio value).
    • Fetching data from repositories and APIs.
    • Updating the View with the latest data.

๐ŸŒ Networking Layer

A reusable networking layer is implemented to handle API requests. Key features include:

  • Generic Requests: Supports reusable API calls for different endpoints.
  • Response Caching: Successful API responses are cached in a shared class to minimize redundant requests and avoid exceeding API rate limits.

๐Ÿ–ผ๏ธ Image Caching

To improve performance and reduce redundant downloads, images are stored locally using FileManager:

  1. Download and Save: When an image is downloaded for the first time, it is saved to the device's file system.
  2. Retrieve: For subsequent requests, the app checks if the image exists locally. If it does, the image is loaded from the local storage.
  3. Update: If the local image is outdated or missing, the app downloads the image again and updates the local storage.

This approach improves performance and reduces network usage.


๐Ÿ—๏ธ Reusable Components

The app leverages reusable UI components to ensure consistency and reduce development time. Examples include:

  • Reusable Collection Views: Used for displaying trending coins, recommended coins, and other lists.
  • Custom Table View Cells: SwiftUI-powered table view cells for displaying coin details and portfolio holdings.
  • Custom Buttons and Views: Reusable buttons (e.g., Buy, Sell, Deposit) and views (e.g., charts, segmented controls) maintain a consistent design across the app.

๐Ÿ“– Usage

  1. Sign Up/Login: Use Firebase Authentication to create an account or log in.
  2. Portfolio Overview: View your total portfolio value and recent gains/losses.
  3. Explore Coins: Search for coins, view details, and add them to your portfolio.
  4. Buy/Sell Coins: Simulate buying and selling coins using dummy card balances.
  5. Track Investments: Monitor your holdings, total invested value, and percentage changes in real-time.

โณ API Rate Limits

To avoid exceeding the CoinGecko API rate limits, the app implements a caching mechanism:

  • Successful API responses are stored in a dictionary.
  • Subsequent requests for the same data are served from the cache.

๐Ÿ”ฎ Future Improvements

  • Real Transactions: Integrate with a payment gateway for real transactions.
  • Push Notifications: Notify users about significant price changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages