Skip to content

Releases: kean/Nuke

Nuke 8.1

25 Aug 07:40
Compare
Choose a tag to compare
  • Configure dispatch queues with proper QoS – #291
  • Remove synchronization points in ImageDecoder which is not needed starting from iOS 10 – #277, Michael Nisi)
  • Add Swift Package Manager to Installation Guides
  • Improve Travis CI setup: run tests on multiple Xcode versions, run thread safety tests, run SwiftLint validations, build demo project, validate Swift package – #279, #280, #281, #284, #285

Nuke 8.0.1

21 Jul 12:28
Compare
Choose a tag to compare
  • Remove synchronization in ImageDecoder which is no longer needed – #277

Nuke 8.0

08 Jul 17:12
Compare
Choose a tag to compare

Nuke 8 is the most powerful, performant, and refined release yet. It contains major advancements it some areas and brings some great new features.

Cache processed images on disk · New built-in image processors · ImagePipeline v2 · Up to 30% faster main thread performance · Result type · Improved deduplication · os_signpost integration · Refined ImageRequest API · Smart decompression · Entirely new documentation

Most of the Nuke APIs are source compatible with Nuke 7. There is also a Nuke 8 Migration Guide to help with migration.

Image Processing

#227 Cache Processed Images on Disk

ImagePipeline now supports caching of processed images on disk. 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 or write a custom one.

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

#243 New Image Processors

Nuke now ships with a bunch of built-in image processors including:

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

There are also ImageProcessor.Anonymous to create one-off processors from closures and ImageProcessor.Composition to combine two or more processors.

#245 Simplified Processing API

Previously Nuke offered multiple 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 gone! You can simply use ImageProcessing protocol directly in places where previously you had to use a type-erased version.

#229 Smart Decompression

In the previous versions, 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 version, decompression runs automatically and it no longer a "processor". The new decompression is also smarter. It runs only when needed – when we know that image is still in a compressed format and wasn't decompressed by one of the image processors.

Decompression runs on a new separate imageDecompressingQueue. To disable decompression you can set a new isDecompressionEnabled pipeline configuration option to false.

#247 Avoiding Duplicated Work when Applying Processors

The pipeline avoids doing any duplicated work when loading images. Now it also avoids applying the same processors more than once. For example, let's take these two 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. The class was introduced in Nuke 7 and it contained a lot of incidental complexity due to addition of progressive decoding and some other new features. In Nuke 8 it was rewritten to fully embrace progressive decoding. The new pipeline is smaller, simpler, easier to maintain, and more reliable.

It is also faster.

+30% Main Thread Performance

The image pipeline spends even less time on the main thread than any of the previous versions. It's up to 30% faster than Nuke 7.

#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 the new ImageRequestOptions struct and the request initializer can now be used to customize all of the request parameters.

#255 filteredURL

You can now provide a filteredURL to be used as a key for caching in case the URL contains transient query parameters:

let request = ImageRequest(
    url: URL(string: "http://example.com/image.jpeg?token=123")!,
    options: ImageRequestOptions(
        filteredURL: "http://example.com/image.jpeg"
    )
)

#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

Performance

Apart from the general performance improvements Nuke now also offers a great way to measure performance and gain visiblity into how the system behaves when loading images.

#250 Integrate os_signpost

Integrate os_signpost logs for measuring performance. To enable the logs set ImagePipeline.Configuration.isSignpostLoggingEnabled (static property) to true before accessing the shared pipeline.

With these logs, you have visibility into the image pipeline. For more information see WWDC 2018: Measuring Performance Using Logging which explains os_signpost in a great detail.

Screenshot 2019-06-01 at 10 46 52

Documentation

All the documentation for Nuke was rewritten from scratch in Nuke 8. It's now more concise, clear, and it even features some fantastic illustrations:

Screenshot 2019-06-11 at 22 31 18

The screenshots come the the reworked demo project. It gained new demos including Image Processing demo and also a way to change ImagePipeline configuration in runtime.

Misc

  • Add a cleaner way to set ImageTask priority using a new priority property – #251
  • [macOS] Implement image cost calculation for ImageCache#236
  • [watchOS] Add WKInterfaceImage support
  • Future-proof Objective-C ImageDisplaying protocol by adding nuke_ prefixes to avoid clashes in Objective-C runtime
  • Add convenience func decode(data: Data) -> Image? method with a default isFinal argument to ImageDecoding protocol – e3ca5e
  • Add convenience func process(image: Image) -> Image? method to ImageProcessing protocol
  • DataCache will now automatically re-create its root directory if it was deleted underneath it
  • Add public flush method to DataCache

Nuke 8.0-rc.1

12 Jun 17:30
Compare
Choose a tag to compare
Nuke 8.0-rc.1 Pre-release
Pre-release

Nuke 8 is the most powerful, performant, and refined release yet. It contains major advancements it some areas and brings some great new features. One of the highlights of this release is the documentation which was rewritten from the ground up.

Cache processed images on disk · New built-in image processors · ImagePipeline v2 · Up to 30% faster main thread performance · Result type · Improved deduplication · os_signpost integration · Refined ImageRequest API · Smart decompression · Entirely new documentation

Most of the Nuke APIs are source compatible with Nuke 7. There is also a Nuke 8 Migration Guide to help with migration.

Image Processing

#227 Cache Processed Images on Disk

ImagePipeline now supports caching of processed images on disk. 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 or write a custom one.

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

#243 New Image Processors

Nuke now ships with a bunch of built-in image processors including:

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

There are also ImageProcessor.Anonymous to create one-off processors from closures and ImageProcessor.Composition to combine two or more processors.

#245 Simplified Processing API

Previously Nuke offered multiple 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 gone! You can simply use ImageProcessing protocol directly in places where previously you had to use a type-erased version.

#229 Smart Decompression

In the previous versions, 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 version, decompression runs automatically and it no longer a "processor". The new decompression is also smarter. It runs only when needed – when we know that image is still in a compressed format and wasn't decompressed by one of the image processors.

Decompression runs on a new separate imageDecompressingQueue. To disable decompression you can set a new isDecompressionEnabled pipeline configuration option to false.

#247 Avoiding Duplicated Work when Applying Processors

The pipeline avoids doing any duplicated work when loading images. Now it also avoids applying the same processors more than once. For example, let's take these two 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. The class was introduced in Nuke 7 and it contained a lot of incidental complexity due to addition of progressive decoding and some other new features. In Nuke 8 it was rewritten to fully embrace progressive decoding. The new pipeline is smaller, simpler, easier to maintain, and more reliable.

It is also faster.

+30% Main Thread Performance

The image pipeline spends even less time on the main thread than any of the previous versions. It's up to 30% faster than Nuke 7.

#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 the new ImageRequestOptions struct and the request initializer can now be used to customize all of the request parameters.

#255 filteredURL

You can now provide a filteredURL to be used as a key for caching in case the URL contains transient query parameters:

let request = ImageRequest(
    url: URL(string: "http://example.com/image.jpeg?token=123")!,
    options: ImageRequestOptions(
        filteredURL: "http://example.com/image.jpeg"
    )
)

#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

Performance

Apart from the general performance improvements Nuke now also offers a great way to measure performance and gain visiblity into how the system behaves when loading images.

#250 Integrate os_signpost

Integrate os_signpost logs for measuring performance. To enable the logs set ImagePipeline.Configuration.isSignpostLoggingEnabled (static property) to true before accessing the shared pipeline.

With these logs, you have visibility into the image pipeline. For more information see WWDC 2018: Measuring Performance Using Logging which explains os_signpost in a great detail.

Screenshot 2019-06-01 at 10 46 52

Documentation

All the documentation for Nuke was rewritten from scratch in Nuke 8. It's now more concise, clear, and it even features some fantastic illustrations:

Screenshot 2019-06-11 at 22 31 18

The screenshots come the the reworked demo project. It gained new demos including Image Processing demo and also a way to change ImagePipeline configuration in runtime.

Misc

  • Add a cleaner way to set ImageTask priority using a new priority property – #251
  • [macOS] Implement image cost calculation for ImageCache#236
  • [watchOS] Add WKInterfaceImage support
  • Future-proof Objective-C ImageDisplaying protocol by adding nuke_ prefixes to avoid clashes in Objective-C runtime
  • Add convenience func decode(data: Data) -> Image? method with a default isFinal argument to ImageDecoding protocol – e3ca5e
  • Add convenience func process(image: Image) -> Image? method to ImageProcessing protocol
  • DataCache will now automatically re-create its root directory if it was deleted underneath it
  • Add public flush method to DataCache

Nuke 8.0-beta.4

07 Jun 20:20
Compare
Choose a tag to compare
Nuke 8.0-beta.4 Pre-release
Pre-release

A small bump to address the feedback from Nuke 8.0-beta.3.

  • Improve debug descriptions for processors, adopt reverse DNS notation for cache keys
  • Revert the changes made in #254 Improve image view extensions. There is going to be no major changes in the primary Nuke.loadImage(:) API in Nuke 8. The extensions are going to be revisited when adding SwiftUI and Combine support.
  • Tune the performance, now we can safely say there is a +25% improvement in some of the common use cases on the main thread.
  • [Documentation] Update some of the documentation
  • [Demo] Add a Settings screen to the demo project to allow change ImagePipeline configuration in runtime

Nuke 8.0-beta.3

02 Jun 20:13
5d95278
Compare
Choose a tag to compare
Nuke 8.0-beta.3 Pre-release
Pre-release

#257 Image Processing Improvements

  • Refactor the existing processors
  • Add new ImageProcessor.Crop, previously cropping was an option in ImageProcessor.Resize and there was a known defect when cropping images smaller than the target size which is fixed in the new implementation
  • Make ImageProcessor.Resize and ImageProcessor.Crop available on macOS
  • Add CustomStringConvertible implementations for each image processor
  • Add documentation for image processors

#259 Revert Addition of ImageTaskDelegate

  • ImageTaskDelegate was a new API introduced in Nuke 8.0-beta.1 to improve the pipeline performance. After some extensive profiling it was clear that this change wasn't truly worth the increased complexity and the changes in the established public API, thus this change was reverted.

Nuke 8.0-beta.2

01 Jun 22:00
Compare
Choose a tag to compare
Nuke 8.0-beta.2 Pre-release
Pre-release

There quite a few important changes in this update. Probably the most important one is the addition of Deprecated.swift file which eases the transition from Nuke 7 to Nuke 8 which are now almost completely source compatible.

Naturally, this beta includes everything from Nuke 8.0-beta.1.

#250 Integrate os_signpost for profiling

Integrate os_signpost logs for measuring performance. To enable the logs set ImagePipeline.Configuration.isSignpostLoggingEnabled (static property) to true before accessing the shared pipeline.

With these logs, you have visibility into the image pipeline. For more information see WWDC 2018: Measuring Performance Using Logging which explains os_signpost in a great detail.

Screenshot 2019-06-01 at 10 46 52

#254 Improve Image Loading Extensions

  • Add imageView.nk.setImage(with:) family of methods as a replacement for Nuke.loadImage(with:into:). The latter wasn't grammatically correct, that's the first. setImage(with:) methods are also more conventional. So now in order to load an image and display it in a view you would simply do this:
imageView.nk.setImage(with: URL(string: "http://example.com/image.jpeg")!)
  • Future-proof Objective-C ImageDisplaying protocol by adding nuke_ prefixes to avoid clashes in Objective-C runtime
  • Add WKInterfaceImage support

Other Changes

  • Enable processing deduplication by default – #252
  • Add filterURL options to ImageRequestOptions to filter unwanted query parameters when generating cache keys - #255
  • Add Deprecated.swift file to ease transition from Nuke 7 to Nuke 8 - #253
  • Implement image cost calculation in ImageCache for macOS – #236
  • Add a cleaner way to set ImageTask priority using a new priority property – #251
  • Add convenience func decode(data: Data) method with a default isFinal argument to ImageDecoding protocol – e3ca5e
  • DataCache will now automatically re-create its root directory if it was deleted underneath it

Nuke 8.0-beta.1

23 May 19:12
Compare
Choose a tag to compare
Nuke 8.0-beta.1 Pre-release
Pre-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.

Nuke 7.6.3

01 May 10:44
Compare
Choose a tag to compare
  • Fix #226ImageTask.setPriority(_:) sometimes crashes

Nuke 7.6.2

24 Apr 04:57
Compare
Choose a tag to compare
  • 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.