Created
April 4, 2020 10:54
-
-
Save wizard1066/93d336fb328bdc95aa6540482ae74415 to your computer and use it in GitHub Desktop.
abgwtp16
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 performDrop(info: DropInfo) -> Bool { | |
textID = dropTarget(info: info) | |
if textID == nil { | |
return false | |
} | |
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 | |
// we need to subtract 1 cause array starts at zero | |
self.textColors[self.textID!] = backgrounds[Int(text)! - 1] | |
if boardFull(textColors: self.textColors, figures: self.rect.count) { | |
if confirmColours(textColors: self.textColors, figures: self.rect.count) { | |
timePublisher.send() | |
} | |
} | |
} | |
} | |
} | |
return true | |
} else { | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment