Hi. Please see screenshot. Currently the icon placeholder is small. What I am trying to replicate is to have an area (the one in red) where the place holder icon is in the middle horizontally and vertically.
That same red area is where the downloaded image will be drawn. I think the term for this is aspect ratio if i am not mistaken? That the height should be proportionate based on the width.
I am using Kingfisher to load the image. This is what I have.
KFImage.url(URL(string: ""))
.placeholder {
HStack {
Image(systemName: "photo")
.resizable()
.frame(width: 50, alignment: .center)
.background(.red)
}
.background(.yellow)
.scaledToFit()
}
.fade(duration: 0.25)
.onFailure { error in print("Load image error : \(error) = \(earthquakeDetail.imgUrl)")
}
.resizable()
.aspectRatio(contentMode: .fill)
Based on the screenshot image, the area for HStack is so thin with its height being small. My goal is to create an area like the one in red border.
Thoughts?