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

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
	}
}
Reordering API crashes when if #available or .popover present
 
 
Q