{"id":25020643,"url":"https://github.com/anscoder/retailapp","last_synced_at":"2025-03-30T10:25:46.232Z","repository":{"id":275271512,"uuid":"925605259","full_name":"ANSCoder/RetailApp","owner":"ANSCoder","description":"RetailApp is an iOS shopping app built with Swift, SwiftUI, and Combine, demonstrating modern architecture patterns like Dependency Injection and MVVM. It allows users to browse products, view details, and manage their cart.","archived":false,"fork":false,"pushed_at":"2025-02-01T10:01:22.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T10:24:19.673Z","etag":null,"topics":["dependency-injection","ios-swift","mock","swift-package-manager","swiftui-example","swiftui-learning","swinject","unit-testing"],"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/ANSCoder.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-01T09:24:16.000Z","updated_at":"2025-02-01T10:01:26.000Z","dependencies_parsed_at":"2025-02-01T10:34:49.133Z","dependency_job_id":null,"html_url":"https://github.com/ANSCoder/RetailApp","commit_stats":null,"previous_names":["anscoder/retailapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANSCoder%2FRetailApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANSCoder%2FRetailApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANSCoder%2FRetailApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANSCoder%2FRetailApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ANSCoder","download_url":"https://codeload.github.com/ANSCoder/RetailApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246304212,"owners_count":20755863,"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":["dependency-injection","ios-swift","mock","swift-package-manager","swiftui-example","swiftui-learning","swinject","unit-testing"],"created_at":"2025-02-05T12:16:58.264Z","updated_at":"2025-03-30T10:25:46.214Z","avatar_url":"https://github.com/ANSCoder.png","language":"Swift","readme":"\n\n# RetailApp\n\nRetailApp is a modern iOS application built using **SwiftUI** and **Swift**. It demonstrates best practices in iOS development, including dependency injection, clean architecture, and the coordinator pattern. The app allows users to browse products, view product details, and add items to their cart.\n\n---\n\n## **Features**\n- **Product Listing**: Browse a list of available products.\n- **Product Details**: View detailed information about a product.\n- **Add to Cart**: Add products to the shopping cart.\n- **Dependency Injection**: Uses **Swinject** for dependency management.\n- **Coordinator Pattern**: Implements a coordinator pattern for navigation.\n- **Unit Testing**: Includes unit tests for critical components.\n\n---\n\n## **Technologies Used**\n- **SwiftUI**: For building the user interface.\n- **Swinject**: For dependency injection.\n- **Coordinator Pattern**: For managing navigation flow.\n- **Combine**: For reactive programming (if applicable).\n- **XCTest**: For unit testing.\n\n---\n\n## **Getting Started**\n\n### **Prerequisites**\n- Xcode 14 or later.\n- Swift 5.7 or later.\n- macOS Ventura or later (for Xcode compatibility).\n\n---\n\n### **Installation**\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/ANSCoder/RetailApp.git\n   ```\n2. Open the project in Xcode:\n   ```bash\n   cd RetailApp\n   open RetailApp.xcodeproj\n   ```\n3. Build and run the project using Xcode.\n\n---\n\n### **Project Structure**\nThe project is organized into the following directories:\n\n```\nRetailApp/\n├── Sources/\n│   ├── Models/              # Data models (e.g., Product)\n│   ├── Views/               # SwiftUI views\n│   ├── ViewModels/          # ViewModels for SwiftUI views\n│   ├── Services/            # Service layer (e.g., CartService, AnalyticsService)\n│   ├── Coordinators/        # Navigation coordinators\n│   ├── DIContainer/         # Dependency injection setup\n│   └── Utilities/           # Helper classes and extensions\n├── Tests/                   # Unit tests\n└── RetailApp.xcodeproj      # Xcode project file\n```\n\n---\n\n### **Dependency Injection**\nThe app uses **Swinject** for dependency injection. All dependencies are registered in the `DependencyMap` struct and resolved using the `DIContainer`.\n\n#### **Example: Registering a Dependency**\n```swift\ncontainer.register(CartService.self) { _ in\n    CartManager()\n}\n```\n\n#### **Example: Resolving a Dependency**\n```swift\nlet cartService = DIContainer.shared.resolve(CartService.self)\n```\n\n---\n\n### **Coordinator Pattern**\nThe app uses a coordinator pattern to manage navigation. Each screen has a corresponding coordinator that handles navigation logic.\n\n#### **Example: ProductDetailCoordinator**\n```swift\nfinal class ProductDetailCoordinator: Coordinator {\n    private let product: Product\n    private let resolver: Resolver\n\n    init(product: Product, resolver: Resolver) {\n        self.product = product\n        self.resolver = resolver\n    }\n\n    func start() -\u003e AnyView {\n        let viewModel = resolver.resolve(ProductDetailViewModel.self, argument: product)!\n        return AnyView(ProductDetailView(viewModel: viewModel))\n    }\n}\n```\n\n---\n\n### **Unit Testing**\nThe app includes unit tests for critical components, such as ViewModels and services. Tests are located in the `Tests` directory.\n\n#### **Running Tests**\n1. Open the project in Xcode.\n2. Select the `RetailAppTests` target.\n3. Press `Cmd + U` to run all tests.\n\n---\n\n### **Contributing**\nContributions are welcome! If you'd like to contribute to the project, please follow these steps:\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix.\n3. Commit your changes.\n4. Submit a pull request.\n\n---\n\n### **License**\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n### **Acknowledgements**\n- [Swinject](https://github.com/Swinject/Swinject) for dependency injection.\n- [SwiftUI](https://developer.apple.com/xcode/swiftui/) for building the user interface.\n- [GitHub](https://github.com) for hosting the repository.\n\n---\n\n### **Contact**\nFor questions or feedback, please contact:\n- **Anand Nimje**  \n  GitHub: [ANSCoder](https://github.com/ANSCoder)  \n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanscoder%2Fretailapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanscoder%2Fretailapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanscoder%2Fretailapp/lists"}