Skip to content

Commit ad0cf3c

Browse files
committed
fix(): image didn't appear (moved fetching image from onAppear to initializer)
1 parent 268f724 commit ad0cf3c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/RemoteImage/public/Views/RemoteImage.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ public struct RemoteImage<ErrorView: View, ImageView: View, LoadingView: View>:
4040
case .loading:
4141
return AnyView(
4242
loadingView()
43-
.onAppear {
44-
self.service.fetchImage(ofType: self.type)
45-
}
4643
)
4744
}
4845
}
@@ -52,6 +49,8 @@ public struct RemoteImage<ErrorView: View, ImageView: View, LoadingView: View>:
5249
self.errorView = errorView
5350
self.imageView = imageView
5451
self.loadingView = loadingView
52+
53+
service.fetchImage(ofType: type)
5554
}
5655
}
5756

0 commit comments

Comments
 (0)