Reordering API crashes when if #available or .popover present

I've encountered crashes when trying to reorder items using the new reordering API.

Fatal error: Unexpected identifier type. Expected UUID, got UUID

To reproduce, simply run one of the 2 first tests and comment out the others:

import SwiftUI

@main struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

struct Task: Identifiable {
    let id = UUID()
    var title: String
}

struct ContentView: View {
    @State private var tasks = [
        Task(title: "Design Invoice"),
        Task(title: "Send Proposal"),
        Task(title: "Review Feedback"),
        Task(title: "Publish Update")
    ]

    @State private var showingPopover: Bool = false
    
    var body: some View {
        ScrollView {
            LazyVGrid(
                columns: [
                    GridItem(.adaptive(minimum: 100))
                ]
            ) {
                ForEach(tasks) { task in
                    // Test 1: This will crash when reordering
                    if #available(iOS 26.0, macOS 26, *) {
                        Text(task.title)
                            .frame(maxWidth: .infinity)
                            .padding()
                            .background(.blue.opacity(0.1))
                            .clipShape(.rect(cornerRadius: 12))
                            
                    } else {
                        Text(task.title)
                            .frame(maxWidth: .infinity)
                            .padding()
                            .background(.blue.opacity(0.1))
                            .clipShape(.rect(cornerRadius: 12))
                    }
                    
                    // Test 2: This will also crash
                    Text(task.title)
                        .frame(maxWidth: .infinity)
                        .padding()
                        .background(.blue.opacity(0.1))
                        .clipShape(.rect(cornerRadius: 12))
                        .popover(isPresented: $showingPopover) {
                            Text("Popover")
                        }
                    
                    // Test 3: This is ok
                    Text(task.title)
                        .frame(maxWidth: .infinity)
                        .padding()
                        .background(.blue.opacity(0.1))
                        .clipShape(.rect(cornerRadius: 12))
                }
                .reorderable()
            }
            .reorderContainer(for: Task.self) { difference in
                tasks.apply(difference: difference)
            }
        }
    }
}
   
extension Array {
    mutating func apply<CollectionID: Hashable & Sendable>(
        difference: ReorderDifference<Element.ID, CollectionID>
    ) where Element: Identifiable, Element.ID: Sendable {

        // Find the source element that moved.
        guard let sourceIndex = firstIndex(
            where: { $0.id == difference.sources[0] }
        ) else { return }

        let movedElement = remove(at: sourceIndex)

        // Find the destination of that element.
        var destination: Int

        switch difference.destination.position {
        case let .before(value):
            guard let index = firstIndex(
                where: { $0.id == value }
            ) else { return }
            destination = index

        case .end:
            destination = endIndex
        }

        insert(movedElement, at: destination)
    }
}

I hope this is not just a limitation for the 27 release and is a bug that will be addressed in the next betas.

Perhaps I'm just doing something wrong? In such case, thanks for pointing out what.

FB23640379

Answered by DTS Engineer in 904765022

Hello @Lucky7,

Thank you for providing a workaround here on the Forums as well as in your FB report. This helps others who run into the issue as well as the teams investigating it. That is much appreciated.

I have made sure the relevant engineering team is aware of the issue.

Updates will be provided to you through Feedback Assistant. There, you can track if the report is still being investigated, has a potential identified fix, or has been resolved in another way.

For more details on Feedback Status, please see “Understanding the Status of Your Feedback” linked here: https://developer.apple.com/bug-reporting/status

 Travis

If you embed your view in another view, for example a VStack, then the crash no longer occurs:

VStack {
	if #available(iOS 26.0, macOS 26, *) {
		Text(task.title)
			.frame(maxWidth: .infinity)
			.padding()
			.background(.blue.opacity(0.1))
			.clipShape(.rect(cornerRadius: 12))
	} else {
		Text(task.title)
			.frame(maxWidth: .infinity)
			.padding()
			.background(.blue.opacity(0.1))
			.clipShape(.rect(cornerRadius
	}
}

Hello @Lucky7,

Thank you for providing a workaround here on the Forums as well as in your FB report. This helps others who run into the issue as well as the teams investigating it. That is much appreciated.

I have made sure the relevant engineering team is aware of the issue.

Updates will be provided to you through Feedback Assistant. There, you can track if the report is still being investigated, has a potential identified fix, or has been resolved in another way.

For more details on Feedback Status, please see “Understanding the Status of Your Feedback” linked here: https://developer.apple.com/bug-reporting/status

 Travis

Reordering API crashes when if #available or .popover present
 
 
Q