{"id":13751549,"url":"https://github.com/AliAdam/ImageWithActivityIndicator","last_synced_at":"2025-05-09T18:31:33.650Z","repository":{"id":63902945,"uuid":"191959842","full_name":"AliAdam/ImageWithActivityIndicator","owner":"AliAdam","description":"SwiftUI view that download and display image from URL and displaying Activity Indicator while loading .","archived":false,"fork":false,"pushed_at":"2020-01-21T22:01:38.000Z","size":23,"stargazers_count":27,"open_issues_count":4,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T21:02:36.280Z","etag":null,"topics":[],"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/AliAdam.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}},"created_at":"2019-06-14T14:47:48.000Z","updated_at":"2023-05-05T21:29:55.000Z","dependencies_parsed_at":"2023-01-14T13:00:21.137Z","dependency_job_id":null,"html_url":"https://github.com/AliAdam/ImageWithActivityIndicator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliAdam%2FImageWithActivityIndicator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliAdam%2FImageWithActivityIndicator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliAdam%2FImageWithActivityIndicator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliAdam%2FImageWithActivityIndicator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliAdam","download_url":"https://codeload.github.com/AliAdam/ImageWithActivityIndicator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253303024,"owners_count":21886873,"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":[],"created_at":"2024-08-03T09:00:48.335Z","updated_at":"2025-05-09T18:31:33.290Z","avatar_url":"https://github.com/AliAdam.png","language":"Swift","funding_links":[],"categories":["🌎 by the community"],"sub_categories":[],"readme":"# ViewWithActivityIndicator\n\n\n\n`ViewWithActivityIndicator` is a SwiftUI view that download and  display image from URL  and displaying Activity Indicator while loading . \n\n# ScreenShots\n\n![N|Solid](https://github.com/AliAdam/ViewWithActivityIndicatorDemo/blob/master/preview.gif?raw=true)\n\n Demo app [ViewWithActivityIndicatorDemo](https://github.com/blackwiz4rd/ViewWithActivityIndicatorDemo).\n\n## Installation\n\n`ViewWithActivityIndicator` is a Swift Package and you can install it with Xcode 11:\n- Copy SSH `git@github.com:blackwiz4rd/ViewWithActivityIndicator.git` or HTTPS `https://github.com/blackwiz4rd/ViewWithActivityIndicator.git` URL from github;\n- Open **File/Swift Packages/Add Package Dependency...** in Xcode 11;\n- Paste the URL and follow steps.\n\n## Usage\n\n`ViewWithActivityIndicator` must be initialized with a URL and optional placeholder image.\n\n```swift\nlet url = \"\"\n\n ViewWithActivityIndicator(imageURL: url)\n\n ViewWithActivityIndicator(imageURL: url,placeHolder: \"icon\")\n``` \n\nUsing in a view:\n\n```swift\nimport SwiftUI\nimport ViewWithActivityIndicator\n\nstruct ContentView : View {\n\n\n    let loader: ViewLoader = ViewLoader(url: \"https://picsum.photos/300\")\n\n    var body: some View {\n        ViewWithActivityIndicator(placeHolder: \"\", showActivityIndicator: true, viewLoader: loader) {\n            Image(uiImage: UIImage(data:self.loader.getData()) ?? UIImage())\n        }\n    } \n}\n```\n\nUsing in a list:\n\n```swift\nimport SwiftUI\nimport ViewWithActivityIndicator\n\nstruct ContentView : View {\nlet urls: [String]\nlet loader: ViewLoader = ViewLoader(url: \"https://picsum.photos/300\")\n\nvar body: some View {\nList(urls, id: \\.self) { url in\nHStack {\nViewWithActivityIndicator(imageURL: url)\n.frame(width: 100.0, height: 100.0)\nText(\"\\(url)\")\n}\n}\n}\n}\n```\n\nViewLoaders allows to create multiple loaders given a String array:\n```swift\n@available(iOS 13.0, *)\npublic struct ViewLoaders {\n    var loaders: [ViewLoader] = []\n    init(urls: [String]) {\n        for url in urls {\n            loaders.append(ViewLoader(url: url))\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAliAdam%2FImageWithActivityIndicator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAliAdam%2FImageWithActivityIndicator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAliAdam%2FImageWithActivityIndicator/lists"}