From e54d309f39a7b22d477b85351caad3c90459b06a Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Tue, 22 Sep 2020 10:45:13 -0700 Subject: [PATCH] [AltWidget] Preserves layout if app icon is missing --- AltWidget/WidgetView.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/AltWidget/WidgetView.swift b/AltWidget/WidgetView.swift index 60579045..f0417977 100644 --- a/AltWidget/WidgetView.swift +++ b/AltWidget/WidgetView.swift @@ -29,13 +29,11 @@ struct WidgetView : View VStack(alignment: .leading, spacing: 5) { let imageHeight = geometry.size.height * 0.45 - app.icon.map { - Image(uiImage: $0) - .resizable() - .aspectRatio(CGSize(width: 1, height: 1), contentMode: .fit) - .frame(height: imageHeight) - .mask(RoundedRectangle(cornerRadius: imageHeight / 5.0, style: .continuous)) - } + Image(uiImage: app.icon ?? UIImage()) + .resizable() + .aspectRatio(CGSize(width: 1, height: 1), contentMode: .fit) + .frame(height: imageHeight) + .mask(RoundedRectangle(cornerRadius: imageHeight / 5.0, style: .continuous)) Text(app.name.uppercased()) .font(.system(size: 12, weight: .semibold, design: .rounded))