From b084945b0f3cd34cec5de1daee41acc54c358626 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 29 Mar 2020 21:27:11 +0800 Subject: [PATCH] Remove the extra AnyView wrap --- SDWebImageSwiftUI/Classes/WebImage.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDWebImageSwiftUI/Classes/WebImage.swift b/SDWebImageSwiftUI/Classes/WebImage.swift index 4914a07..424552d 100644 --- a/SDWebImageSwiftUI/Classes/WebImage.swift +++ b/SDWebImageSwiftUI/Classes/WebImage.swift @@ -137,12 +137,12 @@ public struct WebImage : View { /// Placeholder View Support func setupPlaceholder() -> some View { // Don't use `Group` because it will trigger `.onAppear` and `.onDisappear` when condition view removed, treat placeholder as an entire component - if placeholder != nil { + if let placeholder = placeholder { // If use `.delayPlaceholder`, the placeholder is applied after loading failed, hide during loading :) if imageManager.options.contains(.delayPlaceholder) && imageManager.isLoading { return AnyView(configure(image: Image.empty)) } else { - return AnyView(placeholder) + return placeholder } } else { return AnyView(configure(image: Image.empty))