|
|
|
Hey Now seeks advice for delaying code execution:
This hint might be useful? Wait?! Is it pronouced "Hey Now?" or "Hal No?" |
|
How I would approach:
:) I am sure there is a more sophisticated way, but this what I thought for now.. |
|
|
|
@ioannisfa Not quite figuring it out. Here's my code:
|
|
I like Rooster's delay function. When I did this challenge I used google to get the answer I used.
I don't know if it's the right way or best practice, but it worked for me. |
|
|
|
Late to the show, but I wanted to do the same thing, and I ended up using the following code to make it work. Update
I actually learned this today from the following article: Main Actor Task will allow us to run the code in the background, sleep for x amount of seconds, then MainActor will ensure the next code runs on the UI thread. |
|
@daffyduck Thank you very many of this code snippet. I tried to found this kind of easy solution for delaying Alert. Have to check also that Main Actor infopage. |
SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.