Swiftpack.co -  kean/NukeBuilder as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
kean/NukeBuilder
A fun and convenient way to use Nuke
.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: 12
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Dependencies

Release Notes

NukeBuilder 0.9.0
2 weeks 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