A MacOS version for Shimmer
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];
NSTextField *loadingLabel = [[NSTextField alloc] initWithFrame:shimmeringView.bounds];
loadingLabel.stringValue = @"Shimmer Shimmer Shimmer Shimmer Shimmer Shimmer Shimmer";
shimmeringView.contentView = loadingLabel;
// Start shimmering.
shimmeringView.shimmering = YES;
Two options:
- Using Cocoapods, add to your podfile:
pod 'ShimmerMacOS', :git => 'https://github.com/avishic/ShimmerMacOS.git'
- Just copy the files to your Xcode project
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.
Original Shimmer for iOS also available on GitHub. Shimmer for Android also available on GitHub.
Shimmer is BSD-licensed. They also provide an additional patent grant.