[AltWidget] Preserves layout if app icon is missing

This commit is contained in:
Riley Testut
2020-09-22 10:45:13 -07:00
parent 50a5d56856
commit e54d309f39

View File

@@ -29,13 +29,11 @@ struct WidgetView : View
VStack(alignment: .leading, spacing: 5) { VStack(alignment: .leading, spacing: 5) {
let imageHeight = geometry.size.height * 0.45 let imageHeight = geometry.size.height * 0.45
app.icon.map { Image(uiImage: app.icon ?? UIImage())
Image(uiImage: $0) .resizable()
.resizable() .aspectRatio(CGSize(width: 1, height: 1), contentMode: .fit)
.aspectRatio(CGSize(width: 1, height: 1), contentMode: .fit) .frame(height: imageHeight)
.frame(height: imageHeight) .mask(RoundedRectangle(cornerRadius: imageHeight / 5.0, style: .continuous))
.mask(RoundedRectangle(cornerRadius: imageHeight / 5.0, style: .continuous))
}
Text(app.name.uppercased()) Text(app.name.uppercased())
.font(.system(size: 12, weight: .semibold, design: .rounded)) .font(.system(size: 12, weight: .semibold, design: .rounded))