Skip to content

feat!: Remove legacy layout#556

Merged
watt merged 9 commits intomainfrom
awatt/remove-legacy-mode
Jun 16, 2025
Merged

feat!: Remove legacy layout#556
watt merged 9 commits intomainfrom
awatt/remove-legacy-mode

Conversation

@watt
Copy link
Collaborator

@watt watt commented May 24, 2025

Removes the legacy layout mode! May be easier to review by commit.

Following this change, layouts that define a single trait type will be required to explicitly conform to SingleTraitLayout to use the existing API for accessing traits (previously this was implicit via LegacyLayout).

I've updated layouts to remove legacy implementations, and in some cases refactored to remove the "shim" that allowed a shared implementation. But not all of them; in particular I left the Stack layout as-is, so that we can test if there's any performance impact of eagerly reading traits into an array or if the array allocation itself outweighs that.

Alongside this removal I also removed the fillParent mode of ConstrainedAspectRatio, which was already deprecated because it's not useful under caffeinated layout.

BREAKING CHANGE: removes LayoutMode.legacy, LegacyLayout, ConstrainedAspectRatio.ContentMode.fillParent, and requires layouts that define a trait type to add the SingleTraitLayout conformance explicitly.

@watt watt changed the title feat!: remove legacy mode feat!: Remove legacy layout May 24, 2025
Base automatically changed from awatt/layout-keys to main June 5, 2025 21:17
@watt watt force-pushed the awatt/remove-legacy-mode branch from db9f656 to 688dd8a Compare June 5, 2025 22:28
@@ -0,0 +1,2 @@
/// A token reference type that can be used to group associated signpost logs using `OSSignpostID`.
final class SignpostToken {}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from CacheFactory.swift

@watt watt force-pushed the awatt/remove-legacy-mode branch from 688dd8a to ebfca07 Compare June 5, 2025 22:35
@watt watt marked this pull request as ready for review June 5, 2025 22:36
@watt watt requested a review from a team as a code owner June 5, 2025 22:36
import CoreGraphics

/// The implementation of an `ElementContent`.
protocol ContentStorage: LegacyContentStorage, CaffeinatedContentStorage {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real nit but is it even worth keeping the caffeinated name in the protocol anymore? I guess it's helpful historically?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda like the flexibility of composition, but there's no technical reason it has to stay. For the sake of reducing churn I'm not going to remove it in this PR.

layoutMode: LayoutMode
) -> CGSize {
switch layoutMode {
case .legacy:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, should we strip out this enum? Even the stuff I was playing with lived under options.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think I could flatten it into a struct without breaking too much more stuff, sure.

@@ -229,32 +226,15 @@ extension Flow {
cache: inout ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't super specific to this PR but it didn't really seem like anyone used this cache parameter, do they? Should we get rid of that as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't write many new layouts these days, and the existing ones were never really updated to take advantage of it. But like the most of the caffeinated API, it mimicks the SwiftUI Layout, so I don't really want to remove it.

Copy link
Contributor

@maxg-square maxg-square left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nits but overall looks great, you love to see it:
image

@watt watt merged commit 80a0786 into main Jun 16, 2025
4 checks passed
@watt watt deleted the awatt/remove-legacy-mode branch June 16, 2025 21:38
kyleve added a commit that referenced this pull request Jun 26, 2025
…t-shift

* origin/main:
  Fix multi-line link accessibility paths
  Added support for tabbing through links in `AttributedLabel`
  chore: release 6.0.0 (#560)
  feat!: Remove legacy layout (#556)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants