From 1e10d9c95ca7455877623d167a037ced1d5b39de Mon Sep 17 00:00:00 2001 From: KrLite Date: Thu, 19 Dec 2024 20:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20aspect=20ratio=20?= =?UTF-8?q?handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Luminare/Utilities/Extensions/View+Extensions.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/Luminare/Utilities/Extensions/View+Extensions.swift b/Sources/Luminare/Utilities/Extensions/View+Extensions.swift index 48e764b..b4a7149 100644 --- a/Sources/Luminare/Utilities/Extensions/View+Extensions.swift +++ b/Sources/Luminare/Utilities/Extensions/View+Extensions.swift @@ -252,12 +252,19 @@ public extension View { } @ViewBuilder func luminareAspectRatio( - _ aspectRatio: CGFloat? = nil, contentMode: ContentMode, hasFixedHeight: Bool? = nil + _ aspectRatio: CGFloat?, contentMode: ContentMode, hasFixedHeight: Bool? = nil ) -> some View { environment(\.luminareAspectRatio, aspectRatio) environment(\.luminareAspectRatioContentMode, contentMode) .assigning(\.luminareAspectRatioHasFixedHeight, hasFixedHeight) } + + @ViewBuilder func luminareAspectRatio( + contentMode: ContentMode, hasFixedHeight: Bool? = nil + ) -> some View { + environment(\.luminareAspectRatioContentMode, contentMode) + .assigning(\.luminareAspectRatioHasFixedHeight, hasFixedHeight) + } @ViewBuilder func luminareAspectRatio( _ aspectRatio: CGSize, contentMode: ContentMode, hasFixedHeight: Bool? = nil