示例工程 41-system-integration

41-system-integration/Diagnostics/DropNotTransferable.swift

swift · 0.3 KB

// 故意编译失败:dropDestination 的类型必须满足 Transferable。
// 复现:swiftc -typecheck Diagnostics/DropNotTransferable.swift
import SwiftUI
 
struct Payload {
    let text = ""
}
 
struct Bad: View {
    var body: some View {
        Color.clear.dropDestination(for: Payload.self) { _, _ in true }
    }
}