Created
April 4, 2020 07:25
abgwtp13
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
VStack(alignment: .center, spacing: 8) { | |
ForEach((0 ..< self.textValue.count).reversed(), id: \.self) { row in | |
HStack(alignment: .center, spacing: 8) { | |
ForEach((0 ..< self.textValue.count).reversed(), id: \.self) { column in | |
return VStack { | |
if self.textColors[fCalc(c: column, r: row, x: self.textValue.count)] == Color.clear { | |
Text(self.textText[fCalc(c: column, r: row, x: self.textValue.count)]) | |
.font(Fonts.futuraCondensedMedium(size:fontSize - 12)) | |
.frame(width: minWidith, height: minHeight, alignment: .center) | |
.background(InsideView(rect: self.$rect)) | |
.onDrop(of: ["public.utf8-plain-text"], delegate: dropDelegate) | |
.onTapGesture { | |
if self.poke != "" { | |
self.textText[fCalc(c: column, r: row, x: self.textValue.count)] = self.poke | |
self.textColors[fCalc(c: column, r: row, x: self.textValue.count)] = backgrounds[Int(self.poke)! - 1] | |
self.poke = "" | |
} | |
} | |
// .onAppear { | |
// self.textText[fCalc(c: column, r: row, x: self.textValue.count)] = String(fCalc(c: column, r: row, x: self.textValue.count)) | |
// } | |
} else { | |
Text(self.textText[fCalc(c: column, r: row, x: self.textValue.count)]) | |
.onTapGesture { | |
if self.poke != "" { | |
self.textText[fCalc(c: column, r: row, x: self.textValue.count)] = self.poke | |
self.textColors[fCalc(c: column, r: row, x: self.textValue.count)] = backgrounds[Int(self.poke)! - 1] | |
self.poke = "" | |
} else { | |
self.textText[fCalc(c: column, r: row, x: self.textValue.count)] = "" | |
self.textColors[fCalc(c: column, r: row, x: self.textValue.count)] = Color.clear | |
} | |
} | |
.font(Fonts.futuraCondensedMedium(size:fontSize)) | |
.frame(width: minWidith, height: minHeight, alignment: .center) | |
.background(self.textColors[fCalc(c: column, r: row, x: self.textValue.count)]) | |
.onDrop(of: ["public.utf8-plain-text"], delegate: dropDelegate) | |
.onDrag { | |
self.textColors[fCalc(c: column, r: row, x: self.textValue.count)] = Color.clear | |
let copyCell = self.textText[fCalc(c: column, r: row, x: self.textValue.count)] | |
self.textText[fCalc(c: column, r: row, x: self.textValue.count)] = "" | |
return NSItemProvider(object: copyCell as NSItemProviderWriting) } | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment