I can't find a way to implement a wait function, I'm using swiftforwindows and no examples online have been able to solve it so far. It's Swift 4.2
The class is basically an array that when a function is called each index on the array gets a constant value deducted. the tick function is what is being called. I'm new to Swift.
class resProj {
var list = [1,1,1,1]
var projReq = [100,200,300,50]
var completed = false
func tick(){
    for count in 0..<projReq.count{
        if projReq[count] <= list[count]{
            projReq[count] = 0
        }
        else if projReq[count] > list[count]{
            projReq[count] -= list[count]
        }
    }
    print(projReq)
}
init(
    mathsP      mathsIn:    Int,
    scienceP    sciecnceIn: Int,
    enginerP    enginerIn:  Int,
    businessP   businessIn: Int) {
    self.list [0] = mathsIn
    self.list [1] = sciecnceIn
    self.list [2] = enginerIn
    self.list [3] = businessIn
    }
 }
var spaceElev = resProj(
mathsP:     10,
scienceP:   20,
enginerP:   30,
businessP:  5)
var x = false
while x == false{
//wait function here pls//
print("tick", terminator:"?")
let y = readLine()
if y == "y"{
    spaceElev.tick()
}
else{
    print("gotta put y")
    }
var templist = spaceElev.projReq
var templistcount = 0
templistcount = templist.count
for loop in 0..<templistcount{
    if templist[loop] == 0{
        templistcount -= 1
    }
}
if templistcount == 0 {
    x = true
    print("project completed")
}
}
     }
Where it says //wait function here pls// I would like to make the program wait for 1 second.