Skip to content
Sign UpLog In
Profile icon

JDOG787

@JDOG787
No longer active
GitHub
Website
Repls
Community
JDOG787
JDOG787
shared a Post
3 years ago
How do I delay code in swift?
I can't figure out how to delay code in swift. I'm modifying one of my repls and I want some of my code be delayed but I can't figure out how to do it
Krazy0range
Krazy0range
This works for me! usleep(1000000) usleep takes a time in milliseconds, so the code above would wait for 1 second, so this is what I do: func Wait(_ time: UInt32) { usleep(time * 1000000) } That function above takes one argument, time, which is how many seconds to wait. This should work, because I use it myself. Hope this helps!2 years ago
JDOG787
JDOG787
@CodeABC123 These don't work for some reason. The first I knew about but it does work. second doesn't work I think because it use objective c. All of them give me an error.3 years ago