File tree 1 file changed +4
-10
lines changed
Sources/ImageViewerRemote
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,6 @@ public struct ImageViewerRemote: View {
27
27
28
28
loader = ImageLoader ( url: imageURL)
29
29
}
30
-
31
- func getURLRequest( url: String ) -> URLRequest {
32
- let url = URL ( string: url) !
33
- var request = URLRequest ( url: url)
34
- request. httpMethod = " GET "
35
-
36
- return request;
37
- }
38
30
39
31
@ViewBuilder
40
32
public var body : some View {
@@ -60,7 +52,7 @@ public struct ImageViewerRemote: View {
60
52
VStack {
61
53
ZStack {
62
54
if ( self . disableCache == nil || self . disableCache == false ) {
63
- URLImage ( url: URL ( string: self . imageURL) !, content: { image in
55
+ URLImage ( url: URL ( string: self . imageURL) ?? URL ( string : " https://via.placeholder.com/150.png " ) !, content: { image in
64
56
image
65
57
. resizable ( )
66
58
. aspectRatio ( self . aspectRatio? . wrappedValue, contentMode: . fit)
@@ -321,7 +313,9 @@ class ImageLoader: ObservableObject {
321
313
init ( url: Binding < String > ) {
322
314
self . url = url
323
315
324
- load ( )
316
+ if ( url. wrappedValue. count > 0 ) {
317
+ load ( )
318
+ }
325
319
}
326
320
327
321
deinit {
You can’t perform that action at this time.
0 commit comments