From 07aa917340f4de3ae69fce361b8f8ace21ce4ebc Mon Sep 17 00:00:00 2001 From: Yuya Oka Date: Thu, 19 Aug 2021 21:15:15 +0900 Subject: [PATCH] Update README.md --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29692fe..0fe851f 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,39 @@ let package = Package( ) ``` -## Example +## Usage -Please see Example project. +```swift +import MultipleImageView + +final class SomeView: UIView, MultipleImageViewDelegate { + + func configure() { + let imageView = MultipleImageView(frame: .zero) + addSubview(imageView) + // Autolayout + imageView.sources = [ + .uiimage(anyImage), + .url(anyURL), + .custom { imageView in + // something fetch image + imageView.image = image + } + ] + imageView.delegate = self + } + + // MARK: - MultipleImageViewDelegate + func multipleImageViewShouldGetImage(_ imageView: UIImageView, sourceForURL url: URL, index: Int) { + // Your project's image fetch & cache algorithm. + } + + func multipleImageViewDidSelect(_ imageView: UIImageView, index: Int) { + } +} +``` + +And please see Example project. ## License