Merge pull request #3347 from stuartbreckenridge/widget-icons

Resolves partial widget images
This commit is contained in:
Maurice Parker 2021-11-09 16:18:30 -06:00 committed by GitHub
commit c82678644c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -13,15 +13,18 @@ struct ArticleItemView: View {
var article: LatestArticle
var deepLink: URL
@State private var iconImage: UIImage?
var body: some View {
Link(destination: deepLink, label: {
HStack(alignment: .top, spacing: nil, content: {
// Feed Icon
Image(uiImage: thumbnail(article.feedIcon))
.resizable()
.frame(width: 30, height: 30)
.cornerRadius(4)
if iconImage != nil {
Image(uiImage: iconImage!)
.resizable()
.frame(width: 30, height: 30)
.cornerRadius(4)
}
// Title and Feed Name
VStack(alignment: .leading) {
@ -45,7 +48,9 @@ struct ArticleItemView: View {
}
}
})
})
}).onAppear {
iconImage = thumbnail(article.feedIcon)
}
}
func thumbnail(_ data: Data?) -> UIImage {