{"id":13340150,"url":"https://github.com/0xLeif/RemoteImage","last_synced_at":"2025-03-11T16:32:30.736Z","repository":{"id":231789888,"uuid":"782593269","full_name":"0xLeif/RemoteImage","owner":"0xLeif","description":"🖼️ SwiftUI View for efficiently loading, displaying, and caching images from a remote URL","archived":false,"fork":false,"pushed_at":"2024-04-05T23:26:29.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T10:46:32.426Z","etag":null,"topics":["async","cache","image","images","ios","macos","swift","swiftui","tvos","visionos","watchos"],"latest_commit_sha":null,"homepage":"https://0xleif.github.io/RemoteImage/","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/0xLeif.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}},"created_at":"2024-04-05T16:02:56.000Z","updated_at":"2024-04-10T12:48:51.000Z","dependencies_parsed_at":"2024-04-06T00:26:20.070Z","dependency_job_id":"9ab35f42-2364-46ef-be65-a19b1ecb0dd1","html_url":"https://github.com/0xLeif/RemoteImage","commit_stats":null,"previous_names":["0xleif/remoteimage"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FRemoteImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FRemoteImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FRemoteImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FRemoteImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xLeif","download_url":"https://codeload.github.com/0xLeif/RemoteImage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243070497,"owners_count":20231464,"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","cache","image","images","ios","macos","swift","swiftui","tvos","visionos","watchos"],"created_at":"2024-07-29T19:22:08.178Z","updated_at":"2025-03-11T16:32:25.693Z","avatar_url":"https://github.com/0xLeif.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RemoteImage\n\nRemoteImage is a Swift package that provides a SwiftUI View for loading and displaying images from a remote URL. It also caches the images for efficient reuse. Importantly, RemoteImage is designed for performance - it only loads an image once for a given URL, avoiding unnecessary network requests and optimizing app performance.\n\n**Requirements:** iOS 16.0+ / watchOS 9.0+ / macOS 13.0+ / tvOS 16.0+ / visionOS 1.0+ | Swift 5.9+ / Xcode 15+\n\n## **Getting Started**\n\nTo integrate RemoteImage into your Swift project, you'll need to use the Swift Package Manager (SPM). SPM makes it easy to manage Swift package dependencies. Here's what you need to do:\n\n1. Add a package dependency to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/0xLeif/RemoteImage.git\", from: \"1.0.0\")\n]\n```\n\nIf you're working with an App project, open your project in Xcode. Navigate to `File \u003e Swift Packages \u003e Add Package Dependency...` and enter `https://github.com/0xLeif/RemoteImage.git`.\n\n1. Next, don't forget to add RemoteImage as a target to your project. This step is necessary for both Xcode and SPM Package.swift.\n\nAfter successfully adding RemoteImage as a dependency, you need to import RemoteImage into your Swift file where you want to use it. Here's a code example:\n\n```swift\nimport RemoteImage\n```\n\nFinally you will want to load the default dependencies before using them in SwiftUI Views. To do this just call `Application.loadRemoteImageDependencies`.\n\n```swift\nimport AppState\nimport RemoteImage\nimport SwiftUI\n\n@main\nstruct ExampleApp: App {\n    init() {\n        Application.loadRemoteImageDependencies()\n    }\n\n    // ...\n}\n```\n\n## Usage\n\n### Basic Example\n\nThe basic use of RemoteImage is straightforward. You simply import the required libraries and create an instance of RemoteImage, passing the URL of the image you want to display.\n\n```swift\nimport SwiftUI\nimport RemoteImage\n\nstruct ContentView: View {\n    var body: some View {\n        RemoteImage(url: \"https://image_url.png\")\n    }\n}\n```\n\n### Customized Example\n\nFor a more customized usage, you can supply additional parameters to the RemoteImage instance. In this case, we provide a placeholder view that will be displayed while the image is loading, and a content view that will be displayed once the image is available. The placeholder is a simple `ProgressView`, and the content view takes the loaded image and makes it resizable.\n\n```swift\nimport SwiftUI\nimport RemoteImage\n\nstruct ContentView: View {\n    var body: some View {\n        RemoteImage(\n            url: \"https://image_url.png\",\n            placeholder: { ProgressView() },\n            content: { loadedImage in\n                loadedImage.resizable()\n            }\n        )\n    }\n}\n```\n\nIn this example, `RemoteImage` takes a URL and two view builder closures - `placeholder` and `content`. The placeholder view is displayed while the image is loading. The content view is displayed when the image is available.\n\n## Features\n\n- [x]  Load remote images efficiently\n- [x]  Cache loaded images for performance\n- [x]  Only load an image URL request once, optimizing network utilization\n- [x]  SwiftUI view for displaying remote images\n- [x]  Support for placeholders while images are loading\n- [x]  Fully customizable\n\n## **Contributing**\n\nPlease open an issue or submit a pull request if you have any improvements or features you want to add.\n\n## **Support**\n\nIf you encounter any issues or need further help, please open an issue.\n\n## License\n\nRemoteImage is available under the MIT license. See the [LICENSE](https://github.com/0xLeif/RemoteImage/blob/main/LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xLeif%2FRemoteImage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xLeif%2FRemoteImage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xLeif%2FRemoteImage/lists"}