From 708ad02387fe50f8a0d6898eee057697ba109abc Mon Sep 17 00:00:00 2001 From: Viktor Gardart Date: Fri, 31 Mar 2017 13:12:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B9=20Updated=20readme=20examples=20to?= =?UTF-8?q?=20correct=20syntax.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d41e8e0..3528622 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ a bunch of built-in unicorny features: ### Set image with URL ```swift -let imageView: UIImageView() -let imageUrl: URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") +let imageView = UIImageView() +let imageUrl = URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") imageView.setImage(url: imageUrl) ``` @@ -35,17 +35,17 @@ imageView.setImage(url: imageUrl) ### Apply placeholder images ```swift -let imageView: UIImageView() +let imageView = UIImageView() let placeholder = UIImage(named: "PlaceholderImage") -let imageUrl: URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") +let imageUrl = URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") imageView.setImage(url: imageUrl, placeholder: placeholder) ``` ### Use callback for when the image is set to the image view ```swift -let imageView: UIImageView() -let imageUrl: URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") +let imageView = UIImageView() +let imageUrl = URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") imageView.setImage(url: imageUrl) { image in /// This closure gets called when the image is set to the image view. @@ -60,8 +60,8 @@ imageView.setImage(url: imageUrl) { image in it's being cached and displayed on the screen. ```swift -let imageView: UIImageView() -let imageUrl: URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") +let imageView = UIImageView() +let imageUrl = URL(string: "https://avatars2.githubusercontent.com/u/1340892?v=3&s=200") imageView.setImage(url: imageUrl, preprocess: { image in /// Apply pre-process here ...