{"id":25621064,"url":"https://github.com/cerezo074/stockfinder","last_synced_at":"2026-04-18T14:04:42.445Z","repository":{"id":278458271,"uuid":"935687716","full_name":"cerezo074/StockFinder","owner":"cerezo074","description":"StockFinder is an iOS application designed to efficiently manage and search for stock information. ","archived":false,"fork":false,"pushed_at":"2025-02-19T21:34:10.000Z","size":1350,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T22:25:56.837Z","etag":null,"topics":["async-await","clean-architecture","combine","coordinator-pattern","integration-testing","mvvm","repository-pattern","solid","spm","structure-concurrency","swift","swift-package-manager","swiftdata","swifttest","swiftui","tree","unit-testing","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cerezo074.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-19T21:15:08.000Z","updated_at":"2025-02-19T21:40:22.000Z","dependencies_parsed_at":"2025-02-19T22:25:58.598Z","dependency_job_id":"634baa29-ca8e-43a9-b2a6-2909046409d8","html_url":"https://github.com/cerezo074/StockFinder","commit_stats":null,"previous_names":["cerezo074/stockfinder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerezo074%2FStockFinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerezo074%2FStockFinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerezo074%2FStockFinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerezo074%2FStockFinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cerezo074","download_url":"https://codeload.github.com/cerezo074/StockFinder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240146906,"owners_count":19755387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","clean-architecture","combine","coordinator-pattern","integration-testing","mvvm","repository-pattern","solid","spm","structure-concurrency","swift","swift-package-manager","swiftdata","swifttest","swiftui","tree","unit-testing","xcode"],"created_at":"2025-02-22T08:29:01.158Z","updated_at":"2026-04-18T14:04:39.812Z","avatar_url":"https://github.com/cerezo074.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StockFinder 📈\n\nStockFinder is an iOS application designed to efficiently manage and search for stock information. The app retrieves a large dataset of stock details, stores them locally using **SwiftData**, and provides users with a seamless search experience. Users can quickly find stocks using either their **ticker symbol** or **company name**, ensuring fast and accurate results.\n\nThe app displays key stock details, including:\n- **Ticker Symbol** (e.g., AAPL, TSLA)\n- **Company Name** (e.g., Apple Inc., Tesla Motors)\n- **Current Stock Price** (formatted as currency)\n\nThis data is fetched from an API, stored using **SwiftData**, and presented to users in a clean and modern UI.\n\n---\n\n## 📂 Project Structure\n\nStockFinder follows an **MVVM-C architecture** and applies a **Clean Architecture approach** while adhering to **SOLID principles**. The project is modularized into distinct layers:\n\n- **App**: Entry point of the application.\n- **Core**: Contains essential utilities, services, data structures, and networking logic.\n- **Repositories**: Manages data persistence using **SwiftData**.\n- **UI**: Contains reusable components, UI extensions, fonts, and custom styling.\n- **Domain**: Business logic and core data handling.\n- **Presentation**: Houses views and ViewModels, including **NavigationStack**-based navigation.\n- **Resources**: Fonts, colors, and other assets.\n- **Tests**: Unit tests for critical logic.\n\n---\n\n## ⚡ Optimized Search Performance\n\nStockFinder implements an **efficient search engine** using a **Trie data structure**, optimizing search performance significantly.\n\n\n### 🔍 How It Works:\n- **Trie-based Indexing**: The app indexes stock tickers and names using a **Trie**, making prefix-based search **fast and memory-efficient**.  \n  - **Insertion Complexity**: \\(O(N)\\), where \\(N\\) is the length of the word being inserted.  \n  - **Search Complexity**: \\(O(M)\\), where \\(M\\) is the length of the prefix being searched.  \n  - Without a Trie, the search process would be significantly slower. Instead of quickly traversing the tree structure, the app would need to iterate over the **entire dataset** to filter possible matches. This means:  \n    - **Iterating through all stock entries** (which can be **very large**).  \n    - **Comparing each entry character by character** to validate whether it matches the input.  \n    - This results in a much higher time complexity, making searches slow and inefficient for large datasets.  \n- **Parallelized Search Processing**:  \n  - The app simultaneously builds **two search indexes**: **ticker-based** and **name-based**.  \n  - When the user types, the app first attempts to **find results based on the ticker**.  \n  - If no results are found, it **immediately** searches by **company name**.  \n  - Both operations happen **concurrently**, ensuring a **fast and responsive** search experience.  \n- **Debounced Input with Combine**:  \n  - The app integrates **Combine** with a **debounce mechanism** to avoid unnecessary search executions while the user is still typing.  \n  - This ensures that results are only displayed **when the user pauses**, providing a **better user experience** by showing outcomes when the user is certain of their input.  \n\nInstead of using **Task Groups**, the app utilizes **async let** for parallel execution, reducing overhead while maintaining efficiency.\n\n---\n\n## 🛠️ Tech Stack\n\n- **SwiftUI** – Modern declarative UI framework.\n- **SwiftData** – Local data persistence.\n- **NavigationStack** – Modern SwiftUI navigation handling.\n- **MVVM-C Architecture** – Modular and scalable structure.\n- **SOLID Principles** – Ensuring maintainable and testable code.\n- **Trie Data Structure** – Efficient and fast search indexing.\n- **Advanced Swift Concurrency**:\n  - **Actors** for data consistency and safe concurrent access.\n  - **async/await** for structured concurrency.\n  - **async let** for parallel execution instead of Task Groups.\n- **Combine Framework** – Used for reactive programming, including **debounced search handling**.\n- **Custom Fonts \u0026 UI Styling** – Implements **Poppins** font for modern design.\n\n---\n\n## ✅ Unit Testing Considerations\n\nStockFinder uses the **Swift Testing framework** (instead of XCTest) for unit tests.\n\nUnit tests were implemented for **two key classes**, focusing on the **core functionality** of the app:\n\n1. **StockHomeViewModel**: Handles most of the **presentation logic**.\n2. **StockDataController**: Manages **business logic** and **data persistence**.\n\nThese classes were prioritized because they contain the **most critical logic** in the application.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcerezo074%2Fstockfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcerezo074%2Fstockfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcerezo074%2Fstockfinder/lists"}