Answer the question
In order to leave comments, you need to log in
How to kill a function in Swift 3?
Hello!
The problem is simple, how to kill the running function?
I will describe the problem: the function is loading various videos, and if the download exceeds 15 seconds, I ask the user whether to continue or not.
If yes, continue loading, if not, kill the function. To stop loading and executing this function. How to implement it? Tell.
Answer the question
In order to leave comments, you need to log in
Here you should have some kind of asynchronous task that is executed in a separate thread using OperationQueue
or GCD, you should have some one that will be Timer
called after 15 seconds and check this task
Make a cloner that will accept Bool and if everything is OK, then one code will be executed, and if not, then nothing will happen.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question