-3
AsyncImage(url: URL(string: imageURL)) { image in
   image
} placeholder: {
   Image(systemName: "photo.circle.fill")
}
.padding(40)

I'm trying to use the image in the image but it isn't working. Also, the padding isn't working.

Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52
  • Show a minimal reproducible code that produces your issue, see: [minimal code](https://stackoverflow.com/help/minimal-reproducible-example). Show also the full error message you get, and on what line of your code. What is `imageURL`? – workingdog support Ukraine Jun 28 '23 at 08:15

2 Answers2

0

Are you looking like this

    extension UIImageView {
    func setImage(fromUrl:String?) {
        let placeholderImage : UIImage = UIImage(systemName: "photo.circle.fill")!
        self.image = placeholderImage
        guard let url = URL(string: ~fromUrl?.replacingOccurrences(of: " ", with: "")) else {
            return
        }
        let request = ImageRequest(
            url: url,
            processors: [ImageProcessors.Resize(size: self.bounds.size)],
            priority: .veryHigh
        )
        let options = ImageLoadingOptions(placeholder: placeholderImage, transition: nil, failureImage: placeholderImage, failureImageTransition: nil)
        Nuke.loadImage(with: request, options: options, into: self, progress: nil) { _ in}
    }
}
0
var defaultImage: Image = Image("add-user")
AsyncImage(url: URL(string: imageUrl )) { image in
    image.resizable().aspectRatio(contentMode: .fill).frame(width: 120, height: 120).background(Color.red).cornerRadius(60)
}placeholder: {
        defaultImage.resizable().aspectRatio(contentMode: .fill).cornerRadius(60).frame(width: 120, height: 120)
}
Shabnam Siddiqui
  • 579
  • 4
  • 13