A
A
Aleksandr Govorukhin2017-09-09 19:43:14
iOS
Aleksandr Govorukhin, 2017-09-09 19:43:14

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

3 answer(s)
A
Aleksandr Govorukhin, 2017-09-19
@SnapSh0t

ActiveTask.cancel()

A
Alexander Tikhonov, 2017-09-09
@tikhonov666

Here you should have some kind of asynchronous task that is executed in a separate thread using OperationQueueor GCD, you should have some one that will be Timercalled after 15 seconds and check this task

A
arturios571, 2017-09-09
@arturios571

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 question

Ask a Question

731 491 924 answers to any question