You've made a gorgeous app design, and you've tested your code until you're sure it's bug free. But there's one thing you can't control, which is your user's network connection – and if you need to fetch and display remote data, that means users are going to stare at a blank screen for a few seconds until that data comes back.
Or at least that's what they would do without a beautiful new Swift project called SkeletonView from Juanpe Catalán. This was designed to control the display of your views while your network requests are still running, and automatically provide placeholder graphics for images and text that show something is loading.
The process for enabling skeleton views couldn't be simpler:
someView.isSkeletonable = true
Helpfully, SkeletonView operates recursively: if you call it on a container view, e.g.
view.showSkeleton() for your view controller's main view, then it will wind its way through your view hierarchy to make subviews skeletonable. Even better, you can add gentle animations from built-in defaults, or add your own – it's really customizable!
SkeletonView is available under the MIT license, so this is the kind of thing you can drop in and use to get immediate wins.
Sponsored You’re already busy updating your app for Swift 4.2 and iOS 12, so why not let Instabug help you find and fix bugs? Add just two lines of code to your project and receive comprehensive reports with all the feedback you need to ship a world-class app – click here to learn more!
Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and Mario Kart world champion. OK, so that last part isn't true. If you're curious you can learn more here.