Skip to content

Fix issue when using placeholder and entering edit mode, the web url does not get requested #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions SDWebImageSwiftUI/Classes/WebImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ public struct WebImage : View {
let image: Image
if let platformImage = imageManager.image {
image = Image(platformImage: platformImage)
} else if let placeholder = placeholder {
image = placeholder
} else {
#if os(macOS)
let emptyImage = Image(nsImage: NSImage())
#else
let emptyImage = Image(uiImage: UIImage())
#endif
image = emptyImage
if let placeholder = placeholder {
image = placeholder
} else {
image = Image(platformImage: PlatformImage())
}
// load remote image here, SwiftUI sometimes will create a new View struct without calling `onAppear` (like enter EditMode) :)
// this can ensure we load the image, SDWebImage take care of the duplicated query
self.imageManager.load()
Expand Down