I am working on an iPad app that uses a WKWebView to run a bunch of JavaScript. Swift is mostly used to control the framework for the app, while the Javascript handles the functionality. However, users have reported that after 3-4 hours of use, the app is drastically slower than when they started using it that day, but that this is remedied by restarting the app and/or their iPad. Naturally, this is not a good solution, but I have so far been unable to find a solution that works aside from simply force closing the app upon logging out (I realize this is bad practice).
After running the app through Instruments multiple times with the Leaks and Allocations filters, it looks like there are leaks attributed to:
-[_UIKeyboardTextSelectionGestureController init]
-[UIWebSelectionAssistant addNonEditableForceTextSelectionGestureRecognizersToView:]
These events are tied to page loads and the autofocus on text fields, which indicates that this is strictly an iOS issue, rather than a JavaScript issue.
I have seen other posts related to similar issues but suggested fixes for them have not worked for me so far.
Examples: WKWebView causes my view controller to leak https://forums.developer.apple.com/thread/24539
Any insight would be very helpful. It feels like I've tried everything and gotten no further to the solution.