Created
April 2, 2020 07:15
-
-
Save wizard1066/15d954e460bbd192f9d8fc0108b1bf87 to your computer and use it in GitHub Desktop.
abgwtp6
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
func dropTarget(info: DropInfo) -> Int { | |
if info.location.x > UIScreen.main.bounds.width / 2 { | |
return(1) | |
} else { | |
return(0) | |
} | |
} | |
func performDrop(info: DropInfo) -> Bool { | |
textID = dropTarget(info: info) | |
if let item = info.itemProviders(for: ["public.utf8-plain-text"]).first { | |
item.loadItem(forTypeIdentifier: "public.utf8-plain-text", options: nil) { (urlData, error) in | |
DispatchQueue.main.async { | |
if let urlData = urlData as? Data { | |
let text = String(decoding: urlData, as: UTF8.self) | |
self.textText[self.textID] = text | |
} | |
} | |
} | |
return true | |
} else { | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment