A lot of changes are coming in iOS 10, and while things like iMessage apps get a lot of attention, there’s also some underlying tech that will make all of your apps run a lot faster and smoother.
Another conference. “Great.”
This one’s different, trust us. Our new event for New York is focused on quality, not quantity.
Hre’s the simplest version of how it’s all going to happen: instead of loading content as you scroll, the content those APIs assume you’ll be accessing will load a bit sooner.
If you’re scrolling through an app like Airbnb, there are a lot of ‘cells,’ or blocks of data. If you scroll fast, you’ve likely seen apps jitter trying to keep up. That’s commonly called ‘dropping frames,’ and makes apps look a bit worse than they are.
During a session at WWDC, Apple noted the reason for those dropped frames was that content is loaded just before it lands on-screen. Those cells you’re about to scroll to were loaded milliseconds before you got to them.
Now, Apple is loading those cells well ahead of the time you scroll to them to make sure that when they do land on your screen, the scrolling performance and load times aren’t noticeable. Apple says 60 frames per second is ideal, but existing scrolling performance often misses that mark.
By altering how far ahead of time cells are loaded, Apple says its testing leaves apps well within the scrolling comfort zone of 60 frames per second.
It’s what’s called ‘prefetching data,’ and works in reverse, too. Cells that vanish from your screen as you scroll are kept around a bit longer in case you decide you missed something important and want to scroll back up.
If you keep scrolling up, The same great scrolling performance takes effect.
Apple has also made changes to how your apps access data. New APIs access data asynchronously as before, but make those calls faster. While Apple designed it to work with Core Data, it will work with any solution a developer is using.
To that, database solutions like Realm make a good bit more sense for mobile apps. Already much faster than Core Data or SQLite, Apple’s own loading solutions are finally catching up.
The APIs load data in a background queue so it doesn’t hit the main thread. It’s also adaptive based on scrolling performance, so data can keep up with your actions as cells load.
more less problems
If you’re wondering about apps that have multiple columns, Apple is making a significant change to how those cells are loaded as well.
Currently, apps load entire rows of cells at once. Like single-column apps, it causes some stuttering when you scroll quickly. Moving forward, apps with multiple columns will load cells like tumbling dominoes from left to right.
It gives more complex apps the same performance as simpler apps, and still requires no work from developers. Apple notes it’s best for cells that have similar dimensions, though that’s not requisite.
If you have an app that displays content in page or table views, that’s also no problem. Apple’s cool new reordering API works with those types of apps as well so you don’t have slow load times when you’re scrolling.
Changes are automatic
The interesting part is that developers don’t really need to do anything. All of the changes are done on the back-end to existing APIs. So long as apps are compiled for iOS 10, apps will be a lot smoother and faster, says Apple.
If a developer wants to opt out, they can do so with a single line of code, though I’m not sure why they would.
It’s easy for developers (read: no work involved), and a huge win for users. With a bit of back-end magic, Apple has suddenly made apps faster, which naturally feels like they’re ‘better.’