Skip to content
Pre-release

@kean kean released this May 23, 2019 · 1 commit to master since this release

This is the first Nuke 8 beta. There is going to be at least one more beta released in June updated according to your feedback.

Image Processing Improvements

#227 Caching Processed Images

ImagePipeline now supports caching of processed images. To enable this feature set isDataCacheForProcessedDataEnabled to true in the pipeline configuration and provide a dataCache. You can use a built-in DataCache introduced in Nuke 7.3 which supports parallel reads, and instant writes.

Image cache can significantly improve the user experience in the apps that use heavy image processors like Gaussian Blur.

#243 Add Image Processors

Add the following image processors:

  • ImageProcessor.Resize
  • ImageProcessor.RoundedCorners
  • ImageProcessor.Circle
  • ImageProcessor.GaussianBlur
  • ImageProcessor.CoreImageFilter

More processors will be added in the upcoming releases.

#245 Simplified Processing API

Previously there were quite a few different ways to add processors to the request. Now there is only one, which is also better than all of the previous versions:

let request = ImageRequest(
    url: URL(string: "http://..."),
    processors: [
        ImageProcessor.Resize(size: CGSize(width: 44, height: 44), crop: true),
        ImageProcessor.RoundedCorners(radius: 16)
    ]
)

Processors can also be set using a respective mutable processors property.

Notice that AnyImageProcessor is also finally gone. You can just use ImageProcessing protocol directly everywhere.

#229 Smart Decompression

In the previous versions, the decompression was part of the processing API and ImageDecompressor was the default processor set for each image request. This was mostly done to simplify implementation but it was confusing for the users.

In the new solution, decompression runs automatically and no longer conflicts with the other processors that you set on the request.

The new decompression is also smarter. It runs only when needed: either if there are no processors provided in the request or when these processors didn't change the original image in any way (e.g. ImageProcessor.Resize decided not to upscale the image). Decompression also runs after reading the processed image from disk.

Decompression runs on a new separate imageDecompressingQueue. To disable it set isDecompressionEnabled to false.

#247 Avoiding Duplicated Work when Applying Processors (Experimental)

An experimental feature disabled by default. To enabled it, set isProcessingDeduplicationEnabled to true. When enabled, the pipeline will avoid any duplicated work when processing images. For example, let's take the following requests:

let url = URL(string: "http://example.com/image")
pipeline.loadImage(with: ImageRequest(url: url, processors: [
    ImageProcessor.Resize(size: CGSize(width: 44, height: 44)),
    ImageProcessor.GaussianBlur(radius: 8)
]))
pipeline.loadImage(with: ImageRequest(url: url, processors: [
    ImageProcessor.Resize(size: CGSize(width: 44, height: 44))
]))

Nuke will load the image data only once, resize the image once and apply the blur also only once. There is no duplicated work done at any stage. If any of the intermediate results are available in the data cache, they will be used.

ImagePipeline v2

Nuke 8 introduced a major new iteration of the ImagePipeline class. It was completely rewritten to embrace progressive decoding and deduplication introduced in Nuke 7.

The new pipeline is smaller, simpler, easier to maintain, and more reliable than the previous iteration. It is powered by a new internal Task abstraction which is extremely powerful.

Up to 30% Faster Main Thread Performance

With some of the changed introduced in the pipeline, the primary Nuke.loadImage(with:into:) method became even faster than any of the previous versions on the main thread, up to 30% faster.

#237 Add ImageTaskDelegate

Extend ImagePipeline API with a new method:

public func imageTask(with request: ImageRequest, delegate: ImageTaskDelegate) -> ImageTask

This API is meant to be used for advanced features like progressive image decoding. It is also one of the primary reasons why the pipeline is so much faster in Nuke 8.

#239 Load Image Data

Add a new ImagePipeline method to fetch original image data:

@discardableResult
public func loadData(with request: ImageRequest,
                     progress: ((_ completed: Int64, _ total: Int64) -> Void)? = nil,
                     completion: @escaping (Result<(data: Data, response: URLResponse?), ImagePipeline.Error>) -> Void) -> ImageTask

This method now powers ImagePreheater with destination .diskCache introduced in Nuke 7.4 (previously it was powered by a hacky internal API).

#245 Improved ImageRequest API

The rarely used options were extracted into new ImageRequestOptions struct and the processor initializer can now be used to customize all of the request parameters.

#241 Adopt Result type

Adopt the Result type introduced in Swift 5. So instead of having a separate response and error parameters, the completion closure now has only one parameter - result.

public typealias Completion = (_ result: Result<ImageResponse, ImagePipeline.Error>) -> Void

Future Improvements

There are a few improvements planned for Nuke 8 but which are still in the progress including new performance metrics, new ways to customize cache keys, more processors, more API refinements.

The documentation, the demos, and the migrations guides are also be updated later and available with RC.

Assets 2

@kean kean released this May 1, 2019 · 3 commits to master since this release

  • Fix #226ImageTask.setPriority(_:) sometimes crashes
Assets 2

@kean kean released this Apr 24, 2019 · 7 commits to master since this release

  • Fix Thread Sanitizer warnings. The issue was related to unfair_lock usage which was introduced as a replacement for OSAtomic functions in Nuke 7.6. In order to fix the issue, unfair_lock was replaced with simple NSLock. The performance hit is pretty insignificant and definitely isn't worth introducing this additional level of complexity.
Assets 2

@kean kean released this Apr 13, 2019 · 12 commits to master since this release

Assets 2

@kean kean released this Apr 7, 2019 · 18 commits to master since this release

  • Add Swift 5.0 support – Daniel Storm in #217
  • Add SwiftPM 5.0 support - Vadim Shpakovski in #219
  • Remove Swift 4.0 and Swift 4.1 support
  • Remove iOS 9, tvOS 9, watchOS 2.0, macOS 10.10 and macOS 10.11 support
  • Add a single Nuke target which can build the framework for any platform
  • Replace deprecated OSAtomic functions with unfair_lock, there are no performance regressions
Assets 2

@kean kean released this Dec 26, 2018 · 48 commits to master since this release

  • [macOS] Fix Nuke.loadImage image is not displayed when .fadeIn transition is used – #206
  • Add .alwaysTransition flag to ImageLoadingOptions@gabzsa in #201
Assets 2

@kean kean released this Nov 4, 2018 · 56 commits to master since this release

  • Update Swift version in pbxproj to Swift 4.2, #199
  • Update demo to Swift 4.2
Assets 2

@kean kean released this Oct 21, 2018 · 62 commits to master since this release

Additions

  • #193 Add an option to ImageDecompressor to allow images to upscale, thanks to @drkibitz
  • #197 Add a convenience initializer to ImageRequest which takes an image processor (ImageProcessing) as a parameter, thanks to @drkibitz

Improvements

  • Add a guarantee that if you cancel ImageTask on the main thread, you won't receive any more callbacks (progress, completion)
  • Improve internal Operation performance (async operation subclass), images are loading up to 5% faster

Removals

Nuke 7 had a lot of API changes, to make the migration easier it shipped with Deprecated.swift file (536 line of code) which enabled Nuke 7 to be almost 100% source-compatible with Nuke 6. It's been 6 months since Nuke 7 release, so now it's finally a good time to remove all of this code.

With all these removals, Nuke compiles up to 10% faster. Test coverage is at 93.35%.

Assets 2

@kean kean released this Oct 1, 2018 · 74 commits to master since this release

  • #174 Fix an issue with an ImageView reuse logic where in rare cases a wrong image would be displayed, thanks to @michaelnisi
Assets 2

@kean kean released this Sep 25, 2018 · 80 commits to master since this release

  • Disable automatic stopPreheating which was causing issues
Assets 2
You can’t perform that action at this time.