Image loading system
ImageCache
uses 20% of available RAM which is quite aggressive. It's a good default on iOS because it clears 90% of the used RAM when entering the background to be a good citizen. But it's not a good default on a Mac where the app is constantly running, and the RAM usage is highly visible. Starting with Nuke 12, the default size is now strictly limited by 512 MB.NukeVideo
, so that the users who don't need it, which are the majority, don't need to pay the extra compile time / code size price. With this and other changes in Nuke 12, if you install NukeUI, you are now adding 25% less code to your project compared to Nuke 11.ImageContainer.asset
. The asset is now added to ImageContainer/userInfo
under the new .videoAssetKey
._PlatformImageView
internal (was public)FetchImage/progress
not delivering updatesFetchImage/progress
is now created lazilyFetchImage
FetchImage/image
now returns Image
instead of PlatformImage
FetchImage
to a separate observable object and reduce a number of body
reloadsSee also: Nuke 12.0 (Beta 1) changes
Warning: This is an early preview. The documentation hasn't been updated yet.
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.
NukeUI 2.0 was developed closely with the open-source Ice Cubes app for Mastodon, and every single line in LazyImage
was optimized to achieve the best performance possible.
Starting with NukeUI 2.0, LazyImage
uses SwiftUI.Image
to display images and eliminates any discrepancies between LazyImage
and AsyncImage
layout and self-sizing behavior. And the previously used NukeUI.Image
was removed so it no longer conflicts with SwiftUI.Image
.
NukeUI 1.0 tried to do too much in terms of rendering images which is not its primary responsibility – loading images is. The original design resulted in a convoluted and poorly composable API where LazyImage
would know too much about how the images are rendered. This is no longer the case.
LazyImage
now uses SwiftUI.Image
for rendering images and the layout/sizing behavior matches AsyncImage
exactlyImage
, ImageView
, ImageResizingMode
LazyImage
initializer that accepts content
and placeholder
closures (the same as AsyncImage
)scale
parameter to LazyImage
initializerredacted
not working for LazyImage
Warning: GIF and video rendering are now disabled by default
This release also removes the APIs deprecated in the previous versions of the framework
prepareForReuse
on its animatedImageView
ImageEncoders.ImageIO
losing image orientation - #643
ImageRequestConvertible
- #642
isCompressionEnabled
option to DataCache
that enables compression using Apple’s lzfse algorithmExpressibleByStringLiteral
conformance to ImageRequest
ImagePipeline.shared
warning when Strict Concurrency Checking set to CompleteImagePrefetcher/didComplete
wasn't called in some scenariosImagePrefetcher/didComplete
is now called on the main queueDataLoader/delegate
now gets called for all URLSession/delegate
methods, not just the ones required by Pulse. It allows you to modify DataLoader
behavior in new ways, e.g. for handling authentication challenges.ImagePrefetcher/didComplete
not being called when images are in the memory cache, thanks to @0xceed - #635