Question : delay code execution swift 5
Answered by : wicked-wolf-kfrr7ktv1iyg
let timer = 1
DispatchQueue.main.asyncAfter(deadline: .now() + timer) { // code to execute after 1 second
}
Source : | Last Update : Thu, 29 Apr 21
Question : delay code execution swift 4
Answered by : poised-petrel-lttrfyxc6n48
var dispatchAfter = DispatchTimeInterval.seconds(1)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + dispatchAfter, execute: { // Do your thing
})
Source : https://stackoverflow.com/questions/46407188/binary-operator-cannot-be-applied-to-operands-of-type-dispatchtime-and-in | Last Update : Fri, 24 Jun 22