You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> WARNING: `@ObservedObject` does own the instance, you need to maintain the strong references to the `FetchImage` instances somewhere else.
52
+
53
+
### Lists
54
+
`FetchImage` may also be used in a `List`:
55
+
56
+
```swift
57
+
structDetailsView: View {
58
+
@Statevar refresh: Bool=false
59
+
60
+
var body: some View {
61
+
List(imageUrls, id: \.self) {
62
+
ImageView(url: $0)
63
+
.frame(height: 200)
64
+
}
43
65
}
44
66
}
45
67
```
46
68
69
+
### Priority
47
70
`FetchImage` gives you full control over how to manage the download and how to display the image. For example, one thing that you could do is to replace `onAppear` and `onDisappear` hooks to lower the priority of the requests instead of cancelling them. This might be useful if you want to continue loading and caching the images even if the user leaves the screen, but you still want the images the are currently on screen to be downloaded first.
You may also initialize a `FetchImage` using a Firestore `StorageReference`. These references can be easily created synchronously, but require an asynchronous call in order generate URLs for fetching the requested content. Unfortunately, this makes image loading in SwiftUI rather difficult. Using `Nuke` and `Firebase` together simplifies the whole process quite a bit:
60
84
61
85
```swift
@@ -69,7 +93,7 @@ public var body: some View {
69
93
70
94
## Overview
71
95
72
-
`FetchImage` isan observableobject (`ObservableObject`) that allows you to manage the download of a single image and observe the results of the download. All of the changes to the download state are published using properties marked with `@Published` property wrapper.
96
+
`FetchImage` isa state object, `StateObject` (use `ObservableObject` on iOS 13) that allows you to manage the download of a single image and observe the results of the download. All of the changes to the download state are published using properties marked with `@Published` property wrapper.
0 commit comments