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 boardFull(textColors:[Color],figures:Int) -> Bool { | |
for loop in 0 ..< figures { | |
if textColors[loop] == Color.clear { | |
return false | |
} | |
} | |
return true | |
} |
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 { |
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) { | |
Spacer().padding() | |
Stepper("Cell", onIncrement: { | |
if self.sliderData.sliderValue < cellsUsed(sliderDB: self.sliderDB, figures: self.rect.count) { | |
let (id, figure, color) = self.sliderDB[Int(self.sliderData.sliderValue)] | |
if id != nil { | |
self.textText[id!] = figure! | |
self.textColors[id!] = color! | |
} | |
self.sliderData.sliderValue += 1 |
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) { | |
Spacer().padding() | |
Stepper("Cell", onIncrement: { | |
if self.sliderValue < cellsUsed(sliderDB: self.sliderDB, figures: self.rect.count) { | |
let (id, figure, color) = self.sliderDB[Int(self.sliderValue)] | |
if id != nil { | |
self.textText[id!] = figure! | |
self.textColors[id!] = color! | |
} | |
self.sliderValue += 1 |
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 cellHistory(column:Int, row:Int, tVcount:Int, poke:String, sliderValue:inout Int, sliderDB:inout [(Int?,String?,Color?)], textText:inout [String], textColors:inout [Color]) { | |
sliderDB[Int(sliderValue)] = ((fCalc(c: column, r: row, x: tVcount)),poke,backgrounds[Int(poke)! - 1]) | |
sliderValue = sliderValue + 1 | |
textText[fCalc(c: column, r: row, x: tVcount)] = poke | |
textColors[fCalc(c: column, r: row, x: tVcount)] = backgrounds[Int(poke)! - 1] | |
} |
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 cellHistoryV(column:Int, row:Int, tVcount:Int, poke:String, stepperInst:StepperData, textText:inout [String], textColors:inout [Color]) { | |
let newRec = stepperSteps(stepIndex: (fCalc(c: column, r: row, x: tVcount)), stepText: poke, stepColor: backgrounds[Int(poke)! - 1]) | |
stepperInst.stepperDB[stepperInst.stepperValue] = newRec | |
stepperInst.stepperValue = stepperInst.stepperValue + 1 | |
textText[fCalc(c: column, r: row, x: tVcount)] = poke | |
textColors[fCalc(c: column, r: row, x: tVcount)] = backgrounds[Int(poke)! - 1] | |
} | |
func cellsUsedV(stepperInst:StepperData, figures:Int) -> Int { |
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 cellHistoryV(column:Int, row:Int, tVcount:Int, poke:String, stepperInst:StepperData, textText:inout [String], textColors:inout [Color]) { | |
let newRec = stepperSteps(stepIndex: (fCalc(c: column, r: row, x: tVcount)), stepText: poke, stepColor: backgrounds[Int(poke)! - 1]) | |
if textColors[fCalc(c: column, r: row, x: tVcount)] != Color.clear { | |
let index = stepperInst.stepperDB.firstIndex { $0.stepIndex == fCalc(c: column, r: row, x: tVcount) } | |
stepperInst.stepperDB[index!] = newRec | |
} else { | |
stepperInst.stepperDB[stepperInst.stepperValue] = newRec | |
stepperInst.stepperValue = stepperInst.stepperValue + 1 | |
} |
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
var rectIndex = 0 | |
struct InsideViewV: View { | |
@ObservedObject var stepperInst:StepperData | |
var body: some View { | |
return VStack { | |
// if toggle { | |
GeometryReader { geometry in | |
Rectangle() | |
.fill(Color.yellow) |
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 dropTargetV(info: DropInfo) -> Int? { | |
for squareno in 0..<rectIndex { | |
if stepperInst.stepperDB[squareno].stepRect != nil { | |
if stepperInst.stepperDB[squareno].stepRect!.contains(info.location) { | |
return squareno | |
} | |
} | |
} | |
return nil | |
} |
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 dominoView: View { | |
@State var topNo:Int! | |
@State var lowNo:Int! | |
var body: some View { | |
return ZStack { | |
RoundedRectangle(cornerRadius: 5) | |
.stroke(Color.black, lineWidth: 2) | |
.frame(width: 48, height: 80, alignment: .top) | |
.background(Color.clear) |