Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add an image in case the loading of the url fails? SwiftUI #2321

Open
3 tasks done
luchi17 opened this issue Nov 19, 2024 · 1 comment
Open
3 tasks done

How to add an image in case the loading of the url fails? SwiftUI #2321

luchi17 opened this issue Nov 19, 2024 · 1 comment

Comments

@luchi17
Copy link

luchi17 commented Nov 19, 2024

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

Issue Description

I have tried different ways of adding an image in case of failure but I didn't managed.

What

KFImage.url(URL(string: imageUrl))
.placeholder { ProgressView() } // Muestra un indicador mientras carga
.resizable()
.aspectRatio(contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
.frame(width: 60, height: 60)
.cornerRadius(10)

I tried to add .onFailureImage(someImage) and that does not exist

@luchi17 luchi17 changed the title How to add an image in case the loading of the url fails? How to add an image in case the loading of the url fails? Swift Nov 19, 2024
@luchi17 luchi17 changed the title How to add an image in case the loading of the url fails? Swift How to add an image in case the loading of the url fails? SwiftUI Nov 19, 2024
@prakashrohan
Copy link

the issue can be solved by using AsyncImage or conditional rendering logic like case .empty for loader view , case .success for displaying actual image and case.failure to show a default system image name. If you could please assign the issue to me I would like to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants