Swiftpack.co - kean/NukeBuilder as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by kean.
kean/NukeBuilder 0.9.0
A fun and convenient way to use Nuke
⭐️ 14
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/kean/NukeBuilder.git", from: "0.9.0")

NukeBuilder

A fun and convenient way to use Nuke.

See API Reference for a complete list of available options.

Usage

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.

License

ImageTaskBuilder is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 14
Last commit: 1 year ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

NukeBuilder 0.9.0
1 year ago
  • Update to Nuke 10.0
  • Rename package to NukeBuilder
  • Use ImageRequestConvertible
  • Add Combine support
  • Add ImagePipeline typealias for convenience

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics