Using `containerRelativeFrame` in a `List` on macOS leads to crash

The following code crashes as soon as the app launches.

struct ContentView: View {
    var body: some View {
        List {
            Rectangle()
                .fill(.red)
                .containerRelativeFrame([.horizontal, .vertical])
        }
        .frame(width: 400, height: 800)
    }
}

I would expect the code not to crash. Note that using a ScrollView works perfectly fine:

struct ContentView: View {
    var body: some View {
        ScrollView {
            Rectangle()
                .fill(.red)
                .containerRelativeFrame([.horizontal, .vertical])
        }
        .frame(width: 400, height: 800)
    }
}

The documentation clearly stipulates that it should work with a list:

A scrollable view like ScrollView or List

Using Xcode 26.5 (17F42) and simply created a new macOS project using SwiftUI.

Feedback FB23655564

Answered by DTS Engineer in 897012022

Thanks for the post. Definitely I see the issue

Thread 1: Fatal error: <UpdateCoalescingCollectionView 0x10b984300> is stuck in a recursive layout loop. This can happen when self-sizing views do not return consistent sizes, or the collection view's frame/bounds/contentOffset is being constantly adjusted. 

Thanks for the bug!

You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Albert  WWDR

Accepted Answer

Thanks for the post. Definitely I see the issue

Thread 1: Fatal error: <UpdateCoalescingCollectionView 0x10b984300> is stuck in a recursive layout loop. This can happen when self-sizing views do not return consistent sizes, or the collection view's frame/bounds/contentOffset is being constantly adjusted. 

Thanks for the bug!

You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Albert  WWDR

Using &#96;containerRelativeFrame&#96; in a &#96;List&#96; on macOS leads to crash
 
 
Q