SwiftUI can no longer drag buttons in Xcode 16 Beta 3 or 4

It appears that SwiftUI now prevents Buttons from being dragged. This used to work in Xcode 15.4 and Xcode 16 beta 1-2.

Basically, if the draggable view modifier is associated with a Button, it can no longer be dragged. I have several uses cases where sometimes I want to have an entity behave as a button, but also be draggable.

Example shows case where a Button is draggable. There’s also a simple VStack that is draggable. The VStack works, the button does not.

import Foundation
import CoreTransferable
import UniformTypeIdentifiers

extension UTType {
    static let entityReference: UTType = UTType(exportedAs: "com.mycompany.MyApp.entity-reference")
}

struct EntityReference: Codable, Transferable {
    
    let identifier: String
    
    static var transferRepresentation: some TransferRepresentation {
        CodableRepresentation(contentType: .entityReference)
    }
}

struct ContentView: View {
    var body: some View {
        VStack {
            
            Button {
                print("Button pressed")
            } label: {
                VStack {
                    Text("I'm a button. Try to drag me.")
                        .font(.title)
                }
                .border(.black)
                .padding()
            }
            .draggable(EntityReference(identifier: "some-id"))

            VStack {
                Text("NOT a button. Try to drag me too.")
                    .font(.title)
            }
            .border(.black)
            .padding()
            .draggable(EntityReference(identifier: "some-id"))
            
            VStack {
                Text("Drop area")
                    .font(.title)
            }
            .border(.black)
            .padding()
            .dropDestination(for: EntityReference.self) { droppedEntityReferences, location in

                print("Dropped something here!")

                return true
            }
        }
    }
}

#Preview {
    ContentView()
}

I presume that I can maybe work around this by not using Buttons, but this is not really great for accessibility without adding more custom traits.

Submitted bug report: FB14518001

Answered by DTS Engineer in 797923022

Thanks for flagging this @dmcgloin. Please continue testing on the beta builds.

Thanks for flagging this @dmcgloin. Please continue testing on the beta builds.

This still appears to be an issue on the final version of macOS 15. Is there any update on this?