Align NukeUI.Image self-sizing behavior with SwiftUI.Image
I've noticed that there are some layout differences between SwiftUI.Image and NukeUI.Image when using maxWidth/maxHeight in a List. I'm not sure if it's intentional or not, but it definitely caught me by surprise when I was comparing AsyncImage and LazyImage behaviour.
I've also noticed that the NukeUI.Image can cause sibling Text to truncate after a containing HStack appears after being scrolled offscreen. Sample code and screenshots below. The image used was downloaded from https://picsum.photos/id/0/5616/3744
Xcode: 13.4.1 iOS 15.5
import SwiftUI
import NukeUI
struct ContentView: View {
var body: some View {
List {
HStack {
NukeUI.Image(UIImage(named: "laptop")!)
.resizingMode(.fill)
.frame(width: 100, height: 100)
Text("Nuke - frame(width: 100, height: 100):")
}
HStack {
SwiftUI.Image(uiImage: UIImage(named: "laptop")!)
.resizable()
.frame(width: 100, height: 100)
Text("SwiftUI - frame(width: 100, height: 100):")
}
HStack {
NukeUI.Image(UIImage(named: "laptop")!)
.resizingMode(.fill)
.frame(maxWidth: 100, maxHeight: 100)
Text("Nuke - frame(maxWidth: 100, maxHeight: 100):")
}
HStack {
SwiftUI.Image(uiImage: UIImage(named: "laptop")!)
.resizable()
.frame(maxWidth: 100, maxHeight: 100)
Text("SwiftUI - frame(maxWidth: 100, maxHeight: 100)")
}
HStack {
Rectangle()
.frame(width: 100, height: 800)
Text("A long rectangle")
}
}
}
}

Hi, @robmaceachern. It wasn't designed to work the same way as SwiftUI.Image in terms of layout, and it's most likely impossible given the limitations of the API. The only supported use case is when both dimensions are set explicitly.
There is a new sizeThatFits API (iOS 16) on UIViewRepresentable that could probably be used to align the behavior with SwiftUI.Image.
Addressed in Nuke 12.0 (Beta 1)
Please test it in Nuke 12 (RC1).