A fun and convenient way to use Nuke.
See API Reference for a complete list of available options.
Downloading an image and applying processors.
import NukeBuilder
ImagePipeline.shared.image(with: URL(string: "https://")!)
.resize(width: 320)
.blur(radius: 10)
.priority(.high)
.load { result in
print(result)
}
// Returns a discardable `ImageTask`
Starting with Nuke 10, instead of loading an image right away, you can also create a Combine publisher.
ImagePipeline.image(with: "https://example.com/image.jpeg")
.resize(width: 320)
...
.publisher
You can take the same image that you described previously and automatically display in a view.
let image = ImagePipeline.shared.image(with: URL(string: "https://")!)
.resize(width: 320)
.blur(radius: 10)
.priority(.high)
let imageView: UIImageView
image.display(in: imageView)
.transition(.fadeIn(duration: 0.33))
.placeholder(UIImage.placeholder)
.contentMode(.center, for: .placeholder)
.load()
When you call display(in:)
method you get access to a variety of new options specific to the image view.
ImageTaskBuilder is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 14 |
Last commit: 1 year ago |
ImageRequestConvertible
ImagePipeline
typealias for convenienceSwiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics