Skip to content
An easy way to add a simple, shimmering effect to any view in an iOS app.
Branch: master
Clone or download
klaaspieter and grp Add Carthage support (#74)
* Add Carthage support

Support Carthage by adding a framework scheme and target.

* Set deployment target to 8.0
Latest commit bfeedb7 Jan 7, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples Set the SDK in the example project Apr 12, 2016
FBShimmering.xcodeproj Add Carthage support (#74) Jan 6, 2017
FBShimmering.xcworkspace Initial commit. Feb 25, 2014
FBShimmering Set frame on the content view, rather than layer, for autolayout. Oct 30, 2016
Framework
.gitignore Add build/ to .gitignore. Mar 6, 2014
CONTRIBUTING.md New CLA form Apr 22, 2014
LICENSE Initial commit. Feb 25, 2014
PATENTS Update patent grant: http://fb.me/patents2 Apr 10, 2015
README.md Add link to Shimmer for Android. Mar 9, 2015
Shimmer.podspec
shimmer.gif Initial commit. Feb 25, 2014

README.md

Shimmer

Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator.

Shimmer was originally developed to show loading status in Paper.

Shimmer

Usage

To use Shimmer, create a FBShimmeringView or FBShimmeringLayer and add your content. To start shimmering, set the shimmering property to YES.

An example of making a label shimmer:

FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:shimmeringView];

UILabel *loadingLabel = [[UILabel alloc] initWithFrame:shimmeringView.bounds];
loadingLabel.textAlignment = NSTextAlignmentCenter;
loadingLabel.text = NSLocalizedString(@"Shimmer", nil);
shimmeringView.contentView = loadingLabel;

// Start shimmering.
shimmeringView.shimmering = YES;

There's also an example project. In the example, you can swipe horizontally and vertically to try various shimmering parameters, or tap to start or stop shimmering. (To build the example locally, you'll need to open FBShimmering.xcworkpace rather than the .xcodeproj.)

Installation

There are two options:

  1. Shimmer is available as Shimmer in Cocoapods.
  2. Manually add the files into your Xcode project. Slightly simpler, but updates are also manual.

Shimmer requires iOS 6 or later.

How it works

Shimmer uses the -[CALayer mask] property to enable shimmering, similar to what's described in John Harper's 2009 WWDC talk (unfortunately no longer online). Shimmer uses CoreAnimation's timing features to smoothly transition "on-beat" when starting and stopping the shimmer.

Other Platforms

We have a version of Shimmer for Android, too! It's also available on GitHub.

Contributing

See the CONTRIBUTING file for how to help out.

License

Shimmer is BSD-licensed. We also provide an additional patent grant.

You can’t perform that action at this time.