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 InsideView: View { | |
@Binding var rect: [CGRect] | |
var body: some View { | |
return GeometryReader { geometry in | |
Rectangle() | |
.fill(Color.yellow) | |
.frame(width: 64, height: 32, alignment: .center) | |
.opacity(0.5) | |
.onAppear { | |
self.rect.append(geometry.frame(in: .global)) |
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: 5) { | |
ForEach((0 ..< 4).reversed(), id: \.self) { row in | |
HStack(alignment: .center, spacing: 5) { | |
ForEach((0 ..< 4).reversed(), id: \.self) { column in | |
return VStack { | |
if self.textColors[fCalc(c: column, r: row)] == Color.clear { | |
Text(self.textText[fCalc(c: column, r: row)]) | |
.font(Fonts.futuraCondensedMedium(size:48)) | |
.frame(width: 64, height: 64, alignment: .center) | |
.background(InsideView(rect: self.$rect)) |
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 TheDropDelegate: DropDelegate { | |
@Binding var textID:Int? | |
@Binding var textText:[String] | |
@Binding var rect:[CGRect] | |
@Binding var textColors:[Color] | |
func validateDrop(info: DropInfo) -> Bool { | |
return info.hasItemsConforming(to: ["public.utf8-plain-text"]) | |
} | |
func dropEntered(info: DropInfo) { | |
print("drop entered") |
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 confirmColours(textColors:[Color],figures:Int) -> Bool? { | |
for loop in 0 ..< figures { | |
if textColors[loop] == Color.clear { | |
return false | |
} | |
} | |
} |
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 confirmColours(textColors:[Color],figures:Int) -> Bool? { | |
for loop in 0 ..< figures { | |
if textColors[loop] == Color.clear { | |
return false | |
} | |
} | |
var tfigures = figures - 1 | |
let rfigure = Int(Double(figures).squareRoot()) | |
for _ in 0..<rfigure { | |
var superSet = Set<String>() |
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 dropUpdated(info: DropInfo) -> DropProposal? { | |
let item = info.hasItemsConforming(to: ["public.utf8-plain-text"]) | |
let dp = DropProposal(operation: .move) | |
self.startStop = true | |
// self.textValue = "" | |
runOnce = false | |
return dp | |
} |
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
.onReceive(resetPublisher, perform: { (_) in | |
self.showingReset = true | |
}) | |
Spacer().alert(isPresented:$showingReset) { | |
Alert(title: Text("Reset Sure?"), message: Text("Zudoku Reset?"), primaryButton: .destructive(Text("Reset")) { | |
for loop in 0 ..< self.textValue.count * self.textValue.count { | |
self.textText[loop] = "" | |
self.textColors[loop] = Color.clear |
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
HStack(alignment: .center, spacing: 8) { | |
ForEach((0 ..< textValue.count), id: \.self) { column in | |
Text(self.textValue[column]) | |
.font(Fonts.futuraCondensedMedium(size: fontSize)) | |
.frame(width: minWidith, height: minHeight, alignment: .center) | |
.background(backgrounds[column]) | |
.cornerRadius(minHeight/2) | |
.onTapGesture { | |
self.poke = self.textValue[column] | |
} |
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)) |
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 { |