Created
April 2, 2020 07:07
-
-
Save wizard1066/f33bfaa7ce04930546896e656aeb6ae1 to your computer and use it in GitHub Desktop.
abgwtp3
This file contains 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
struct ContentView: View { | |
@State private var rect: CGPoint = CGPoint() | |
@State private var textText:String = "" | |
@State private var textValue:String = "Hello World" | |
var body: some View { | |
let dropDelegate = TheDropDelegate(textText: $textText) | |
return VStack { | |
Spacer() | |
Text(textValue).background(InsideView(rect: $rect)) | |
.onDrag { | |
return NSItemProvider(object: self.textValue as NSItemProviderWriting) } | |
Spacer() | |
Text(textText) | |
.frame(width: 128, height: 20, alignment: .center) | |
.background(Color.yellow) | |
.onDrop(of: ["public.utf8-plain-text"], delegate: dropDelegate) | |
Spacer() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment