in the iOS App (Swift 5) I use the PDF Export framework. It generates a few PDFs from the UIViews. Now, while generating I present a UIActivityViewController which worked fine. The Activity is spinning and the PDFs are generated. The whole process is like 2-3 seconds long. During this time the CPU is 95-100% loaded, almost all of which is taken on main Thread (PDF is UI stuff)
Now, I'we decided to add some small animation, while generating PDFs. It is a JSON export from After Effects and being implemented in the App with help of Lotti. It is also a UI thing, but there is no space to show the animation smoothly on the screen - it's lagging (like really bad).
To solve the problem I tried
- doing as much work in background thread as possible,
- dispatching back with async and the same QoS (does not make difference which) (also with flag to force QoS),
- using Thread with low priority and QoS instead of DispatchQueue.
Nothing really helps. The lag is still there.
Can someone help, please?
Maybe some other solution will help - if I figure out a way to say to the block of code, that it can dispatch back to main thread, but take not more than some amount of %. But I think it is not possible.
The example project is here. The video of run is here
Thanks!