I have a problem with delaying computer's move in a game.
I've found some solutions but they don't work in my case, e.g.
var delay = NSTimer.scheduledTimerWithTimeInterval(4, target: self, selector: nil, userInfo: nil, repeats: false)
I tried to use this with function fire
but also to no effects.
What other possibilities there are?
In swift we can delay by using
Dispatch_after.
SWift 3.0 :-
Swift 3
With GCD:
or with a timer:
Swift 2
With GCD:
or with a timer:
How about using Grand Central Dispatch?
https://developer.apple.com/library/ios/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html
Valfer has shown you how