gitmyhub

Shimmer

Objective-C ★ 9.3k updated 5y ago ▣ archived

An easy way to add a simple, shimmering effect to any view in an iOS app.

Shimmer is a small, archived iOS library from Facebook that adds a moving light-sweep loading animation, like the skeleton screens in social media apps, to any UI element with a single property toggle.

Objective-CiOSCoreAnimationCocoaPodssetup: easycomplexity 2/5

Shimmer is a small iOS library, originally built by Facebook for their Paper app, that adds a shimmering light-sweep animation to any element on screen. The effect is the kind you have likely seen in social media apps when content is loading: a soft glimmer moves across a placeholder or label to signal that something is on its way. It is not a flashy animation but a quiet, unobtrusive way to let users know the app is working.

Using Shimmer is straightforward. You wrap your existing UI element, like a text label or image view, inside a special container called FBShimmeringView, then flip one property to start the animation. A matching FBShimmeringLayer is also available for lower-level use. The library ships with an interactive example project where you can swipe in different directions to adjust shimmer settings and tap to toggle the effect on and off.

Adding Shimmer to a project can be done through CocoaPods, which is a dependency manager for iOS and Mac projects, or by manually copying the source files directly into Xcode. The library requires iOS 6 or later.

Under the hood, Shimmer works by applying a mask to an iOS layer, a technique built into Apple's animation framework. It uses CoreAnimation's timing features to make the shimmer start and stop smoothly rather than cutting in and out abruptly, keeping the visual effect consistent with the rhythm of the surrounding interface.

This repository sits in Facebook's archive, meaning it is no longer actively maintained. An Android version of the library is available separately on GitHub. The code is released under the BSD license.

Where it fits