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
+53-6
Original file line number
Diff line number
Diff line change
@@ -13,22 +13,49 @@ SDWebImagePhotosPlugin is a plugin for [SDWebImage](https://github.com/rs/SDWebI
13
13
By using this plugin, it allows you to use your familiar View Category method from SDWebImage, to load Photos image with `PHAsset` or `localIdentifier`.
14
14
15
15
## Usage
16
-
To support Photos Library plugin. Firstly add the photos loader to image manager. You can add to the default manager using [loaders manager](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#loaders-manager), or create custom manager for usage.
16
+
**Important!** To use Photos Library plugin. Firstly you need to register the photos loader to image manager.
17
+
18
+
There are two ways to register the photos loader. One for temporarily usage (when providing URL is definitely Photos URL but not HTTP URL), and another for global support (don't need any check, support both HTTP URL as well as Photos URL).
19
+
20
+
#### Use custom manager (temporarily)
21
+
You can create custom manager for temporary usage. When you use custom manager, be sure to specify `SDWebImageCustomManager` context option with your custom manager for View Category methods.
let manager = SDWebImageManager(cache: SDImageCache.shared, loader: SDWebImagePhotosLoader.shared)
30
35
```
31
36
37
+
#### Use loaders manager (globally)
38
+
You can replace the default manager using [loaders manager](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#loaders-manager) to support both HTTP && Photos URL globally. Put these code just at the application launch time before any SDWebImage loading was triggered.
39
+
40
+
+ Objective-C
41
+
42
+
```objectivec
43
+
// Supports HTTP URL as well as Photos URL globally
SDWebImagePhotosPlugin supports GIF images stored in Photos Library as well. Just use the same API as normal images to query the asset. We will query the image data and decode the animated images (compatible with `UIImageView` as well as [SDAnimatedImageView](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#animated-image-50))
91
+
92
+
#### Custom Options
62
93
To specify custom options like `PHFetchOptions` or `PHImageRequestOptions`. Either to change the property in loader, or provide a context options for each Photos Library image request.
63
94
64
95
+ Objective-C
@@ -67,6 +98,8 @@ To specify custom options like `PHFetchOptions` or `PHImageRequestOptions`. Eith
@@ -112,6 +147,18 @@ Note that because the dependency SDWebImage currently is in beta. You should use
112
147
github "SDWebImage/SDWebImagePhotosPlugin"
113
148
```
114
149
150
+
## Demo
151
+
152
+
If you have some issue about usage, SDWebImagePhotosPlugin provide a demo for iOS && macOS platform. To run the demo, clone the repo and run the following command.
153
+
154
+
```bash
155
+
cd Example/
156
+
pod install
157
+
open SDWebImagePhotosPlugin.xcworkspace
158
+
```
159
+
160
+
After the Xcode project was opened, click `Run` to build and run the demo.
0 commit comments