From 4bfac18b16d0c8f15e257d13d0d7792bf210339f Mon Sep 17 00:00:00 2001 From: Kazumasa Shimomura Date: Wed, 1 Nov 2023 11:52:45 +0900 Subject: [PATCH] fix: fix swiftui sizing --- Sources/SwiftUISupport/ComponentSwiftUISupport.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/SwiftUISupport/ComponentSwiftUISupport.swift b/Sources/SwiftUISupport/ComponentSwiftUISupport.swift index 94ec7a7..383e793 100644 --- a/Sources/SwiftUISupport/ComponentSwiftUISupport.swift +++ b/Sources/SwiftUISupport/ComponentSwiftUISupport.swift @@ -38,6 +38,11 @@ private struct ComponentRepresenting: UIViewRepresentable { uiView.render(component: AnyComponent(component)) proxy.uiView = uiView } + + @available(iOS 16.0, *) + func sizeThatFits(_ proposal: ProposedViewSize, uiView: UIComponentView, context: Context) -> CGSize? { + uiView.intrinsicContentSize + } } private final class UIComponentView: UIView, ComponentRenderable {