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
Copy file name to clipboardExpand all lines: README.md
+15-10Lines changed: 15 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,15 +63,15 @@ in-memory cache, the in-memory cache, and the on-disk cache. Entries in the
63
63
caches are keyed by an _image identifier_ which is provided by the creator of
64
64
the fetch request or automatically generated from the image fetch's URL.
65
65
66
-
- The _On-Disk Cache_ will maintain both the latest partial image and the largest matching image (based on the image identifier)
66
+
- The _On-Disk Cache_ will maintain both the latest partial image and the largest completed image for an _image identifier_
67
67
- The _In-Memory Cache_ will maintain the largest matching UIImage (based on the image identifier), but has no bias to the image being rendered/decoded or not
68
68
- The _Rendered In-Memory Cache_ will maintain the 3 most recently sized and rendered/decoded UIImages that match (based on the image identifier)
69
69
70
70
The image will simultaneously be loaded into memory (as raw bytes) and
71
71
written to the disk cache when retrieving from the Network. Partial images
72
72
will be persisted as well and not replace any completed images in the cache.
73
73
74
-
Once the image is either hit or retrieved from any of the caches or the
74
+
Once the image is either retrieved from any of the caches or the
75
75
network, the retrieved image will percolate back through the caches in its
76
76
various forms.
77
77
@@ -92,8 +92,8 @@ When the request is made, the fetch operation will perform the following:
92
92
93
93
- Synchronously consult the _Rendered In-Memory Cache_ for an image that will fit the target dimensions and content mode.
94
94
- On miss, asynchronously consult the _In-Memory Cache_ that maintains the UIImage of the largest matching image (based on identifier).
95
-
- On miss, asynchronously consult the _On-Disk Cache_ that maintains the raw bytes of the largest matching image (based on identifier).
96
-
- On miss, asynchronously consult any provided _additional caches_ (based on URL). This is so that legacy caches can be pulled from when transitioning to *TIP* without having to forcibly load all assets again. Twitter additionally uses this with its segregated pipeline design to pull an image from another account's pipeline while maintaining separation in the even of an account's removal which will clear that account's pipeline's caches.
95
+
- On miss, asynchronously consult the _On-Disk Cache_ that maintains the raw bytes of the largest matching image (based on identifier). As an optimization, *TIP* will take it a step further and also consult all other registered _pipeline disk caches_ - thus saving on the cost of network load by pulling from disk. The cross pipeline retrieved image will be stored to the fetching pipeline's caches to maintain image pipeline siloing. _Note:_ this cross pipeline access requires the fetching image identifier and image URL to match.
96
+
- On miss, asynchronously consult any provided _additional caches_ (based on URL). This is so that legacy caches can be pulled from when transitioning to *TIP* without having to forcibly load all assets again.
97
97
- On miss, asynchronously retrieve the image from the _Network_, resuming any partially loaded data that may exist in the _On-Disk Cache_.
98
98
99
99
### Preview Support
@@ -102,14 +102,15 @@ In addition to this simple progression, the fetch operation will offer the first
102
102
(based on image identifier) complete image in the In-Memory Cache or On-Disk Cache
103
103
(rendered and resized to the request's specified target sizing) as a preview image when the URLs
104
104
don't match. At that point, the fetch delegate can choose to just use the preview image or continue
105
-
with the _Network_ loading the final image.
105
+
with the _Network_ loading the final image. This is particularly useful when the fetch image URL is
106
+
for a smaller image than the image in cache, no need to hit the network :)
106
107
107
108
### Progressive Support
108
109
109
110
A great value that the _image pipeline_ offers is the ability to stream progressive scans of an
110
111
image, if it is PJPEG, as the image is loaded from the Network. This progressive rendering is
111
-
natively supported by iOS 8+, but will not be supported in iOS 7 or below. Progressive support is
112
-
opt-in and also configurable in how scans should load.
112
+
natively supported by iOS 8+, but will not be supported in iOS 7 (the minimum OS for *TIP*).
113
+
Progressive support is opt-in and also configurable in how scans should load.
113
114
114
115
### Resuming Image Downloads
115
116
@@ -204,12 +205,16 @@ image pipeline works.
204
205
-`TIPImageContainer`
205
206
- object to encapsulate the relevant info for a fetched image
206
207
- the `TIPImageFetchDelegate` will use `TIPImageContainer` instances for callbacks, and the `TIPImageFetchOperation` will maintain `TIPImageFetchOperation` properties as it progresses.
207
-
-`TIPImageView`
208
-
- convenience encapsulation for dealing with loading a image for display by subclassing `UIImageView`
208
+
-`TIPImageViewFetchHelper`
209
+
- powerful class that can encapsulate the majority of use cases for loading an image and displaying it in a `UIImageView`
210
+
- 99% of image loading and displaying use cases can be solved by using this class, configuring it and providing a delegate and/or data source
211
+
- having the logic in this class avoid coupling _controller_ code with _view_ code in the _MVC_ practice
212
+
-`UIImageView(TIPImageViewFetchHelper)`
213
+
- convenience category on `UIImageView` for associating a `TIPImageViewFetchHelper`
209
214
210
215
## Usage
211
216
212
-
The simplest way to use *TIP* is with the `TIPImageView` and its `TIPImageViewHelper` counterpart.
217
+
The simplest way to use *TIP* is with the `TIPImageViewHelper` counterpart.
213
218
214
219
For concrete coding samples, look at the *TIP Sample App* and *TIP Swift Sample App* (in Objective-C and Swift, respectively).
0 commit comments