Lazy image loading for Apple platforms: SwiftUI, UIKit, AppKit
Image
sizing behavior. Now it again simply takes all the available space and you can use resizingMode
to change the image rendering behavior.LazyImage
LazyImageView
to match LazyImage
in terms of the default parameters: placeholder and animationImageView
(UIKit, AppKit) and Image
(SwiftUI) components that support animated images and are now used by LazyImageView
LazyImageView
API for setting image, use ImageView
directly insteadcontentMode
to resizingMode
LazyImage
custom initialized now suggest NukeUI.Image
LazyImage
to use FetchImage
on all platformsinit(source:content:)
initializer to LazyImage
:LazyImage(source: $0) { state in
if let image = state.image {
image // Displays the loaded image
} else if state.error != nil {
Color.red // Indicates an error
} else {
Color.blue // Acts as a placeholder
}
}
LazyImage
(gray background)LazyImage
supported platforms to iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 10.16LazyImage
on watchOS now has an almost complete feature parity with other platforms. The main exception is the support for animated images which is currently missing.LazyImage
initializer that take ImageContainer
– use LazyImageView
directly insteadimport SwiftSVG
// Affects both all `LazyImage` and `LazyImageView` instances
LazyImageView.registerContentView {
if $0.type == .svg, let string = $0.data.map( {
UIView(SVGData: data)
}
return nil
}
videoPlayerView
, remove separate videoGravity
propertyisLooping
property to VideoPlayerView
which is true
by defaultcontentView
where all content views (both images and video) are displayedisExperimentalVideoSupportEnabled
to isVideoRenderingEnabled
.preventsDisplaySleepDuringVideoPlayback
to false
Initial pre-release version