Created
January 8, 2025 11:11
-
-
Save VAndrJ/4cd24d66694acbcec3153f76aafb63d9 to your computer and use it in GitHub Desktop.
iOS 18.0 visual issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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