diff --git a/Sources/SwiftUISupport/ComponentSwiftUISupport.swift b/Sources/SwiftUISupport/ComponentSwiftUISupport.swift index 38e16f2..da2fcd3 100644 --- a/Sources/SwiftUISupport/ComponentSwiftUISupport.swift +++ b/Sources/SwiftUISupport/ComponentSwiftUISupport.swift @@ -51,7 +51,16 @@ private struct ComponentRepresenting: UIViewRepresentable { if let height = proposal.height { uiView.bounds.size.height = height } - return uiView.intrinsicContentSize + + if uiView.intrinsicContentSize != CGSize(width: UIView.noIntrinsicMetric, height: UIView.noIntrinsicMetric) { + return uiView.intrinsicContentSize + } + + return uiView.systemLayoutSizeFitting( + proposal.replacingUnspecifiedDimensions(by: UIView.layoutFittingCompressedSize), + withHorizontalFittingPriority: .required, + verticalFittingPriority: .fittingSizeLevel + ) } }