Skip to content

Commit

Permalink
Revert Image sizing behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 8, 2021
1 parent e9d43d4 commit d6b6e5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

# NukeUI 0.x

## NukeUI 0.6.2

*Jul 8, 2021*

- Revert the changes to `Image` sizing behavior. Now it again simply takes all the available space and you can use `resizingMode` to change the image rendering behavior.

## NukeUI 0.6.1

*Jun 11, 2021*
Expand Down
4 changes: 2 additions & 2 deletions Sources/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct Image: NSViewRepresentable {
}

public func makeNSView(context: Context) -> ImageView {
let view = ImageViewWrapper()
let view = ImageView()
onCreated?(view)
return view
}
Expand All @@ -53,7 +53,7 @@ public struct Image: UIViewRepresentable {
}

public func makeUIView(context: Context) -> ImageView {
let imageView = ImageViewWrapper()
let imageView = ImageView()
if let resizingMode = self.resizingMode {
imageView.resizingMode = resizingMode
}
Expand Down
20 changes: 0 additions & 20 deletions Sources/ImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,24 +240,4 @@ public class ImageView: _PlatformBaseView {
view.isHidden = true
}
}

final class ImageViewWrapper: ImageView {
#if os(iOS) || os(tvOS)
var _intrinsicContentSize: CGSize = CGSize(width: -1, height: -1)

override var intrinsicContentSize: CGSize {
_intrinsicContentSize
}

override var imageContainer: ImageContainer? {
get { super.imageContainer }
set {
super.imageContainer = newValue
_intrinsicContentSize = systemLayoutSizeFitting(_PlatformBaseView.layoutFittingCompressedSize)
invalidateIntrinsicContentSize()
}
}
#endif
}

#endif

0 comments on commit d6b6e5c

Please sign in to comment.