{"id":21376495,"url":"https://github.com/fluidgroup/swiftui-async-multiplex-image","last_synced_at":"2025-06-11T14:34:15.862Z","repository":{"id":102093087,"uuid":"535798522","full_name":"FluidGroup/swiftui-async-multiplex-image","owner":"FluidGroup","description":"Async image loading for SwiftUI with support for multiple resolutions and efficient handling using Swift concurrency features.","archived":false,"fork":false,"pushed_at":"2025-05-29T08:48:55.000Z","size":96,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-29T09:52:47.610Z","etag":null,"topics":["image","multiplex","swiftui"],"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/FluidGroup.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,"zenodo":null}},"created_at":"2022-09-12T18:25:55.000Z","updated_at":"2025-05-29T08:48:36.000Z","dependencies_parsed_at":"2024-04-04T06:29:39.653Z","dependency_job_id":"29215c4b-4225-44ee-b93d-d52317cfd29c","html_url":"https://github.com/FluidGroup/swiftui-async-multiplex-image","commit_stats":null,"previous_names":["fluidgroup/swiftui-async-multiplex-image"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluidGroup%2Fswiftui-async-multiplex-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluidGroup%2Fswiftui-async-multiplex-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluidGroup%2Fswiftui-async-multiplex-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluidGroup%2Fswiftui-async-multiplex-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FluidGroup","download_url":"https://codeload.github.com/FluidGroup/swiftui-async-multiplex-image/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluidGroup%2Fswiftui-async-multiplex-image/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259280657,"owners_count":22833433,"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":["image","multiplex","swiftui"],"created_at":"2024-11-22T09:15:56.982Z","updated_at":"2025-06-11T14:34:15.797Z","avatar_url":"https://github.com/FluidGroup.png","language":"Swift","readme":"# AsyncMultiplexImage for SwiftUI\n\n\u003cimg width=\"200\" src=\"https://user-images.githubusercontent.com/1888355/189911326-6ce3b24a-ba0a-4b5f-aa1d-7c048e8c64cd.gif\"/\u003e\n\nThis library provides an asynchronous image loading solution for SwiftUI applications. It supports loading multiple image resolutions and automatically handles displaying the most appropriate image based on the available space. The library uses Swift's concurrency model, including actors and tasks, to manage image downloading efficiently.\n\n## Features\n\n- Asynchronous image downloading\n- Supports multiple image resolutions\n- Efficient image loading using Swift's concurrency model\n- Logging utilities for debugging and error handling\n\n## Installation\n\n### Swift Package Manager\n\nAdd the following dependency to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/YourGitHubUsername/AsyncMultiplexImage.git\", from: \"1.0.0\")\n]\n```\n\n## Starter\n\n```\nimport AsyncMultiplexImage\n\nAsyncMultiplexImageNuke(image: .init(constant: URL(...)))\n```\n\n## Usage\n\n1. Import the library:\n\n```swift\nimport AsyncMultiplexImage\n```\n\n2. Define a `MultiplexImage` with a unique identifier and a closure that returns a list of URLs for different image resolutions:\n\n```swift\nlet multiplexImage = MultiplexImage(identifier: \"imageID\", urlsProvider: { _ in\n    [URL(string: \"https://example.com/image_small.png\")!,\n     URL(string: \"https://example.com/image_medium.png\")!,\n     URL(string: \"https://example.com/image_large.png\")!]\n})\n```\n\n3. Create an `AsyncMultiplexImage` view using the `MultiplexImage` and a custom downloader conforming to `AsyncMultiplexImageDownloader`:\n\n```swift\nstruct MyImageView: View {\n    let multiplexImage: MultiplexImage\n    let downloader: MyImageDownloader\n\n    var body: some View {\n        AsyncMultiplexImage(multiplexImage: multiplexImage, downloader: downloader) { phase in\n            switch phase {\n            case .empty:\n                ProgressView()\n            case .progress(let image):\n                image.resizable()\n            case .success(let image):\n                image.resizable()\n            case .failure(let error):\n                Text(\"Error: \\(error.localizedDescription)\")\n            }\n        }\n    }\n}\n```\n\n4. Implement a custom image downloader conforming to `AsyncMultiplexImageDownloader`:\n\n```swift\nclass MyImageDownloader: AsyncMultiplexImageDownloader {\n    func download(candidate: AsyncMultiplexImageCandidate) async throws -\u003e Image {\n        // Download the image and return a SwiftUI.Image instance\n    }\n}\n```\n\n## License\n\nThis library is available under the MIT License. See the [LICENSE](LICENSE) file for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluidgroup%2Fswiftui-async-multiplex-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluidgroup%2Fswiftui-async-multiplex-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluidgroup%2Fswiftui-async-multiplex-image/lists"}