- 📦 Distribute as a dynamic library via Swift Package Manager
- 👍 Podspec now explicitly specifies supported Swift versions - 340, Richard Lee
- 🛠 Fix a memory leak when the URLSession wasn't deallocated correctly - 336
📦 There are two new Swift packages available in Nuke ecosystem:
- FetchImage makes it easy to download images using Nuke and display them in SwiftUI apps. One of the notable features of
FetchImageis support for iOS 13 Low Data mode.
- ImagePublisher provides Combine publishers for some of the Nuke APIs.
- 🛠 Fix an issue with
RoundedCornersimage processor not respecting the
Borderparameter – 327, Eric Jensen
- ➕ Add an optional
borderparameter to the
Circleprocessor – 327, Eric Jensen
- ➕ Add
DataLoaderObservingprotocols to allow users to tap into the internal events of the subsystems to enable logging and other features – 322, Abdallah Nehme
- 🗄 Deprecate
Nuke.Imageto avoid name clashes with
SwiftUI.Imagein the future , add
PlatformImageinstead – 321
- 👉 Make
ImagePipelinemore readable – 320
- ⚡️ Update demo project to use Swift Package Manager instead of CocoaPods – 319
- 🛠 Fix an issue with
- 📦 Switch to a versioning scheme which is compatible with Swift Package Manager
- 🔧 Configure dispatch queues with proper QoS – #291
- ✂ Remove synchronization points in
ImageDecoderwhich is not needed starting from iOS 10 – #277
- ➕ 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 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 ·
Resulttype · Improved deduplication ·
os_signpostintegration · 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.
ImagePipelinenow supports caching of processed images on disk. To enable this feature set
truein the pipeline configuration and provide a
dataCache. You can use a built-in
DataCacheintroduced 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.
Nuke now ships with a bunch of built-in image processors including:
There are also
ImageProcessor.Anonymousto create one-off processors from closures and
ImageProcessor.Compositionto combine two or more processors.
👍 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
AnyImageProcessoris gone! You can simply use
ImageProcessingprotocol directly in places where previously you had to use a type-erased version.
0️⃣ In the previous versions, decompression was part of the processing API and
ImageDecompressorwas 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
isDecompressionEnabledpipeline configuration option to
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.
Nuke 8 introduced a major new iteration of the
ImagePipelineclass. 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.
➕ Add a new
ImagePipelinemethod to fetch original image data:
@discardableResultpublic 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
.diskCacheintroduced in Nuke 7.4 (previously it was powered by a hacky internal API).
The rarely used options were extracted into the new
ImageRequestOptionsstruct and the request initializer can now be used to customize all of the request parameters.
You can now provide a
filteredURLto 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" ) )
Resulttype introduced in Swift 5. So instead of having a separate
errorparameters, the completion closure now has only one parameter -
public typealias Completion = (\_ result: Result\<ImageResponse, ImagePipeline.Error\>) -\> Void
🐎 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.
↔ Integrate os_signpost logs for measuring performance. To enable the logs set
ImagePipeline.Configuration.isSignpostLoggingEnabled(static property) to
truebefore accessing the
🐎 With these logs, you have visibility into the image pipeline. For more information see WWDC 2018: Measuring Performance Using Logging which explains
os_signpostin a great detail.
📚 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:
The screenshots come the the reworked demo project. It gained new demos including Image Processing demo and also a way to change
ImagePipelineconfiguration in runtime.
- ➕ Add a cleaner way to set
ImageTaskpriority using a new
priorityproperty – #251
- 🍎 [macOS] Implement image cost calculation for
- 👍 [watchOS] Add
- 🛠 Future-proof Objective-C
ImageDisplayingprotocol by adding
nuke_prefixes to avoid clashes in Objective-C runtime
- ➕ Add convenience
func decode(data: Data) -> Image?method with a default
ImageDecodingprotocol – e3ca5e
- ➕ Add convenience
func process(image: Image) -> Image?method to
DataCachewill now automatically re-create its root directory if it was deleted underneath it
- ➕ Add public