{"id":24665629,"url":"https://github.com/jivnov/cocktail-app","last_synced_at":"2026-05-16T20:32:52.247Z","repository":{"id":272897910,"uuid":"918095562","full_name":"jivnov/cocktail-app","owner":"jivnov","description":"A simple cocktail application displaying a list of cocktails, each with its name and associated image. Data is fetched using a Basic Authorization header. The UI is built with SwiftUI, and the project can be built using XcodeGen.","archived":false,"fork":false,"pushed_at":"2025-01-19T13:12:13.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T10:52:35.148Z","etag":null,"topics":["swiftui","unittest","xcodegen"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jivnov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-01-17T08:40:13.000Z","updated_at":"2025-01-19T13:12:15.000Z","dependencies_parsed_at":"2025-01-17T10:19:02.725Z","dependency_job_id":"aad51eb4-45ed-4db8-87b5-6345d5dbef05","html_url":"https://github.com/jivnov/cocktail-app","commit_stats":null,"previous_names":["jivnov/cocktail-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jivnov/cocktail-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jivnov%2Fcocktail-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jivnov%2Fcocktail-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jivnov%2Fcocktail-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jivnov%2Fcocktail-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jivnov","download_url":"https://codeload.github.com/jivnov/cocktail-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jivnov%2Fcocktail-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33117829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"ssl_error","status_checked_at":"2026-05-16T18:38:29.903Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["swiftui","unittest","xcodegen"],"created_at":"2025-01-26T07:12:57.593Z","updated_at":"2026-05-16T20:32:52.231Z","avatar_url":"https://github.com/jivnov.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CocktailApp\n\n## Overview\nCocktailApp is a simple SwiftUI app that displays a list of cocktails fetched from a remote URL. The project is built using the **MVVM** architecture and prioritizes **clean code**, **modularity**, and **testability**.\n\n---\n\n## Project Structure\n- **CocktailApp** Folder with app logic and recources. Separeted to the followig folders:\n  - **App**: The main entry point (`CocktailApp`).\n  - **Models**: Contains the `Cocktail` data model, implementing `CocktailProtocol`.\n  - **Views**: Contains the UI logic (`CocktailListView` and `CocktailListCellView`).\n  - **ViewModels**: `CocktailListViewModel` connects the data layer to the views.\n  - **Resources**: Includes `Assets`, `Info.plist`, and `CocktailsSecrets.xcconfig` for managing sensitive credentials.\n  - **Utils**: Provides utilities like `ApiCredentials` to fetch credentials from the environment.\n\n- **CocktailAppTests**: Folder with mock data and tests.\n\n- **CocktailNetworking**: A separate static library for URL requests, including `CocktailAPI` and `CocktailDTO`.\n\n---\n\n## Architecture\n- **MVVM (Model-View-ViewModel)**: Ensures separation of concerns, testability, and clean state management.\n- **No Coordinators**: Due to the app’s simplicity (no navigation flows), coordinators are omitted.\n- **CocktailNetworking** as separate static library while it has no dependencies and is lightweight, making it faster to compile and integrate into the app.\n- **Separation of Data Models**:\n  - `CocktailDTO` (Networking) and `Cocktail` (App) both implement `CocktailProtocol` for decoupling.\n  - This separation adheres to the **Single Responsibility Principle**.\n\n---\n\n## Build with XcodeGen\nThe project uses **XcodeGen** for a clean and declarative setup. To generate the `.xcodeproj`:\n- Run: `xcodegen generate`\n\nThis avoids committing `.xcodeproj` to version control, ensuring a clean repository.\n\n---\n\n## Credentials Management\n\n### **Local Development**\nSensitive credentials (`USER_NAME`, `PASSWORD`) are stored in `CocktailsSecrets.xcconfig`:\n```plaintext\nUSER_NAME = UNAME\nPASSWORD = PASS\n```\n\nThe app retrieves these and URL using `ApiCredentials` struct.\n\n### **Best Practice: CI Integration**\n- Store credentials in CI pipelines.\n\n---\n\n## Testing\nUnit tests are provided for key components:\n- **CocktailListViewModelTests**: Ensures correct data/error handling and API integration.\n- **CocktailAPITest**: Validates networking logic and error handling with mocks.\n- **CocktailDataModelsTests**: Validates data mapping.\n\n---\n\n## Secure Connection Policy\nThe app fetches data from an HTTP URL, requiring a modification to `Info.plist` to bypass App Transport Security (ATS):\n\n```xml\n\u003ckey\u003eNSAppTransportSecurity\u003c/key\u003e\n\u003cdict\u003e\n    \u003ckey\u003eNSAllowsArbitraryLoads\u003c/key\u003e\n    \u003ctrue/\u003e\n\u003c/dict\u003e\n```\n\n---\n\n#### API response example\n\n    [ \n        {\n            \"id\": \"12560\",\n            \"name\": \"Afterglow\",\n            \"imageUrl\": \"https://www.thecocktaildb.com/images/media/drink/vuquyv1468876052.jpg\"\n        }, \n        {\n            \"id\": \"12562\",\n            \"name\": \"Alice Cocktail\",\n            \"imageUrl\": \"https://www.thecocktaildb.com/images/media/drink/qyqtpv1468876144.jpg\"\n        }, \n        {\n            \"id\": \"12862\",\n            \"name\": \"Aloha Fruit punch\",\n            \"imageUrl\": \"https://www.thecocktaildb.com/images/media/drink/wsyvrt1468876267.jpg\"\n        } \n    ]","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjivnov%2Fcocktail-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjivnov%2Fcocktail-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjivnov%2Fcocktail-app/lists"}