File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
SDWebImageSwiftUI/Classes Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ import SwiftUI
55
55
public override var intrinsicContentSize : CGSize {
56
56
/// Match the behavior of SwiftUI.Image, only when image is resizable, use the super implementation to calculate size
57
57
let contentSize = wrapped. intrinsicContentSize
58
- if let _ = resizingMode {
58
+ if resizingMode != nil {
59
59
/// Keep aspect ratio
60
60
if contentSize. width > 0 && contentSize. height > 0 {
61
61
let ratio = contentSize. width / contentSize. height
@@ -74,15 +74,21 @@ import SwiftUI
74
74
super. init ( frame: frameRect)
75
75
addSubview ( wrapped)
76
76
observation = observe ( \. wrapped. image, options: [ . new] ) { [ weak self] _, _ in
77
- self ? . invalidateIntrinsicContentSize ( )
77
+ guard let self = self else {
78
+ return
79
+ }
80
+ self . invalidateIntrinsicContentSize ( )
78
81
}
79
82
}
80
83
81
84
public required init ? ( coder: NSCoder ) {
82
85
super. init ( coder: coder)
83
86
addSubview ( wrapped)
84
87
observation = observe ( \. wrapped. image, options: [ . new] ) { [ weak self] _, _ in
85
- self ? . invalidateIntrinsicContentSize ( )
88
+ guard let self = self else {
89
+ return
90
+ }
91
+ self . invalidateIntrinsicContentSize ( )
86
92
}
87
93
}
88
94
}
You can’t perform that action at this time.
0 commit comments