Answer the question
In order to leave comments, you need to log in
Does Swift work with multithreading out of the box?
I am making a simple program in swift in xcode under os x, but useful for myself, so that I can shovel a lot of data. How to find out if it works in one thread or in all core i5 cores? If in one - how to cut into all?
And another moment. If a large action is launched, then the program can simply "duplicate" for some time and then only show the result. Can I somehow hang a progress bar in a couple of movements?
Answer the question
In order to leave comments, you need to log in
No, it does not work. You probably have no idea what multithreading is and what it is eaten with.
It works in one thread, so if you throw something heavy there, the application will hang. There is no way to "cut into everything", you need to create and manage flows yourself.
As Google has shown in iOS, there is a Grand Central Dispatch that makes the task easier. You probably won’t find documentation for swift in Russian, because everything is still young, but for object-c idev.by/ios/21112
In your case, everything looks something like this. The main thread does dispatch_async, it does something heavy and periodically updates the progress bar from there with dispatch_async .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question