Skip to content

Commit

Permalink
Simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
tevelee committed Jul 30, 2024
1 parent 0668632 commit 95143b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion Sources/Flow/Internal/Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 0 additions & 11 deletions Sources/Flow/Internal/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 95143b3

Please sign in to comment.