Skip to content

Instantly share code, notes, and snippets.

@VAndrJ
Created January 8, 2025 11:11
Show Gist options
  • Save VAndrJ/4cd24d66694acbcec3153f76aafb63d9 to your computer and use it in GitHub Desktop.
Save VAndrJ/4cd24d66694acbcec3153f76aafb63d9 to your computer and use it in GitHub Desktop.
iOS 18.0 visual issue.
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Drag me")
.font(.largeTitle)
.padding()
.frame(maxWidth: .infinity, idealHeight: 200)
.border(.blue)
.background(.green.opacity(0.1))
.draggable(Draggable(identifier: "identifier"))
Spacer()
Text("Drop here")
.font(.largeTitle)
.frame(width: 200, height: 100)
.background(.blue.opacity(0.2))
.dropDestination(for: Draggable.self) { items, location in
print(items, location)
return true
}
}
.padding()
}
}
import UniformTypeIdentifiers
extension UTType {
static let draggable = UTType(exportedAs: "com.vandrj.DraggableMRE.draggable")
}
struct Draggable: Codable, Transferable {
let identifier: String
static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .draggable)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment