From 95143b3be4a38886343041f155a05640b6ec55ab Mon Sep 17 00:00:00 2001 From: Laszlo Teveli Date: Tue, 30 Jul 2024 20:00:00 +0200 Subject: [PATCH] Simplification --- Sources/Flow/Internal/Layout.swift | 2 +- Sources/Flow/Internal/Size.swift | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Sources/Flow/Internal/Layout.swift b/Sources/Flow/Internal/Layout.swift index f46c2790..b8536818 100644 --- a/Sources/Flow/Internal/Layout.swift +++ b/Sources/Flow/Internal/Layout.swift @@ -145,7 +145,7 @@ struct FlowLayout: Sendable { cache: FlowLayoutCache ) -> Lines { let sizes: [Size] = zip(cache.subviewsCache, subviews).map { cache, subview in - if cache.ideal.fits(in: proposedSize) { + if cache.ideal.breadth <= proposedSize.value(on: axis) { cache.ideal } else { subview.sizeThatFits(proposedSize).size(on: axis) diff --git a/Sources/Flow/Internal/Size.swift b/Sources/Flow/Internal/Size.swift index 57cdf4f8..de7f47f9 100644 --- a/Sources/Flow/Internal/Size.swift +++ b/Sources/Flow/Internal/Size.swift @@ -34,17 +34,6 @@ struct Size: Sendable { case .vertical: \.depth } } - - @usableFromInline - func fits(in proposedSize: ProposedViewSize) -> Bool { - if let proposedWidth = proposedSize.width, self[.horizontal] > proposedWidth { - return false - } - if let proposedHeight = proposedSize.height, self[.vertical] > proposedHeight { - return false - } - return true - } } extension Axis {