Image loading system
LazyImage
fails to perform memory cache lookup in some scenariosImageRequest
created with an async function now executes it lazily - https://github.com/kean/Nuke/pull/708 by @khlopkobyCroppingToSquare()
always return square image – https://github.com/kean/Nuke/pull/696 by @zzmasoudmakeImageView
closure to LazyImageView
to allow using custom views for rendering imagesonCompletion
closure to LazyImage
and FetchImage
.videoAssetKey
value missing from ImageContainer
.gif
being encoded as .jpeg
when .storeEncodedImages
policy is usedNuke 12 enhances the two main APIs introduced in the previous release: LazyImage
and the async ImagePipeline
methods. They are faster, more robust, and easier to use.
The migration guide is available to help with the update. The minimum requirements are unchanged from Nuke 11.
NukeUI started as a separate repo, but the initial production version was released as part of Nuke 11. Let's call it NukeUI 1.0. The framework was designed before the AsyncImage
announcement and had a few discrepancies that made it harder to migrate from AsyncImage
. This release addresses the shortcomings of the original design and features a couple of performance improvements.
LazyImage
now uses SwiftUI.Image
instead of NukeUI.Image
backed by UIImageView
and NSImageView
. It eliminates any discrepancies between LazyImage
and AsyncImage
layout and self-sizing behavior and fixes issues with .redacted(reason:)
, ImageRenderer
, and other SwiftUI APIs that don't work with UIKIt and AppKit based views.NukeUI.Image
so the name no longer clashes with SwiftUI.Image
redacted
not working for LazyImage
LazyImage
.FetchImage
to a separate observable object, reducing the number of body reloadsLazyImage
now requires a single body calculation to render the response from the memory cache (instead of three before)LazyImage
processors
or priority
without also changing the image sourceFetchImage/image
now returns Image
instead of UIImage
_PlatformImageView
internal (was public) and remove more typealiasesRedesign the concurrency APIs making them more ergonomic and fully Sendable
compliant.
ImagePipeline/imageTask(with:)
method that returns a new type AsyncImageTask
let task = ImagePipeline.shared.imageTask(with: URL(string: "example.com"))
task.priority = .high
for await progress in task.progress {
print("Updated progress: ", progress)
}
let image = try await task.image
ImagePipeline/image(for:)
method now returns an image instead of ImageResponse
delegate
parameter from ImagePipeline/image(for:)
method to address the upcoming concurrency warnings in Xcode 14.3ImageTaskDelegate
and move its methods to ImagePipelineDelegate
and add the pipeline
parameterImageRequest.ThumbnailOptions
that accepts the target size, unit, and content mode - #677
ImageDecoder
now defaults to scale 1
for images (configurable using UserInfoKey/scaleKey
)Video playback can be significantly more efficient than playing animated GIFs. This is why the initial version of NukeUI provided support for basic video playback. But it is not something that the majority of the users need, so this feature was extracted to a separate module called NukeVideo
.
There is now less code that you need to include in your project, which means faster compile time and smaller code size. With this and some other changes in Nuke 12, the two main frameworks – Nuke and NukeUI – now have 25% less code compared to Nuke 11. In addition to this change, there are a couple of improvements in how the precompiled binary frameworks are generated, significantly reducing their size.
NukeVideo
ImageContainer.asset
. The asset is now added to ImageContainer/userInfo
under the new .videoAssetKey
.Redesign the concurrency APIs in Nuke ahead of the upcoming changes in Xcode 14.3, making them safer and ergonomic to use, and fully Sendable
-compliant.
ImagePipeline/imageTask(with:)
method that returns a new type AsyncImageTask
that you can use to monitor the task progress, change its priority, and, of course, fetch the response.let task = ImagePipeline.shared.imageTask(with: URL(string: "example.com"))
for await progress in task.progress {
print("Updated progress: ", progress)
}
let image = try await task.image
ImagePipeline/image(for:)
methods now return an image (UIImage
or NSImage
) instead of ImageResponse
delegate
parameter from the existing ImagePipeline/image(for:)
async/await method to address the upcoming concurrency warnings in Xcode 14.3ImageTaskDelegate
and move its methods to ImagePipelineDelegate
and add the pipeline
parameterLazyImage
optimization where when the image is in memory cache, LazyImage
now requires a single body calculation to render it (instead of three before) – can't get better than thisImagePipeline/image(for:)
hangs if you cancel the async Task before it is started. Thanks @muukii for reporting and providing a sample.LazyImage(url:content:placeholder:)
init method that doesn't offer much compared to the main init and remove public _LazyImageContents
LazyImage
's processors
or priority
without also changing the image source, the image wasn't being reloadedNukeUI
ImageDecoder
now defaults to scale 1
for imagesscale
parameter from LazyImage
init: it's available via ImageRequest
userInfo