I am using an ImagePicker to select an Image from Library and store in CoreData (as Binary). In another view this selected image is shown as a thumbnail.
I want the user to be free when selecting an image. If he doesn't select an image, it should show a default Thumbnail (which is already shown in the placeholder).
My question is whether the Code below is right logically but not well implemented.
ZStack (alignment: .bottomLeading) {
Image(uiImage: UIImage(data: Group.groupThumbnail ?? self.image)!)
.resizable(capInsets: EdgeInsets())
.aspectRatio(contentMode: .fill)
.frame(height: 200.0, alignment: .center)
.cornerRadius(22)
My Idea would be to do it this way, but it says that this does not work.
ZStack (alignment: .bottomLeading) {
Image(uiImage: UIImage(data: Group.groupThumbnail ?? self.image) ?? Image("defaultGroupThumbnail"))
.resizable(capInsets: EdgeInsets())
.aspectRatio(contentMode: .fill)
.frame(height: 200.0, alignment: .center)
.cornerRadius(22)
I appreciate any advice. Thanks in Advance!