Anyone who has used an iOS device has experienced the frustration caused by a stuttering or pausing user interface.
While users may not notice these small hiccups on the desktop, it’s impossible to miss on the iPhone or iPad where the only thing on the screen is your app.
I’ve mentioned an excellent guide on multithreading with GCD so many of these situations can be avoided, but sometimes you need to do things in the main thread that could be disrupt the user’s experience.
Today I came across an open source library that tracks UI events which is perfect for those times.
The library’s developer Brandon Williams states on the Github page:
A common adage of iOS development is to do as little as possible on the main thread so to not disrupt UI events. However, sometimes it is necessary to some work on the main thread and so we would prefer to do that work when the interface is mostly static (e.g. the user isn’t dragging anything, scroll views aren’t scrolling, etc…).
My favorite place to use this is when saving an NSManagedObjectContext on a background thread that will then merge into the context on the main thread. In particular, I wait until event tracking stops before doing the save, that way if the merge takes some time it will not be noticeable in the UI.
The library is OPEventTracker and can be found on Github here.
Definitely a great idea – no wonder Brandon stated on twitter this library is “This is one of the most useful things I’ve ever made (for the performance obsessed iOS developer)”
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.