← Back to facebook/Shimmer

How to Deploy & Use facebook/Shimmer

Shimmer - Deploy and Usage Guide

Prerequisites

  • iOS Development Environment: Xcode 8.0 or later
  • iOS SDK: iOS 6.0 or later
  • Programming Language: Objective-C
  • Optional: CocoaPods (for dependency management)

Installation

Option 1: Using CocoaPods (Recommended)

  1. Install CocoaPods if not already installed:

    sudo gem install cocoapods
    
  2. Create a Podfile in your project directory:

    platform :ios, '6.0'
    pod 'Shimmer', '~> 1.0'
    
  3. Run the following command to install:

    pod install
    
  4. Open your project's .xcworkspace file instead of .xcodeproj from now on.

Option 2: Manual Installation

  1. Clone the repository:

    git clone https://github.com/facebook/Shimmer.git
    
  2. Drag the following files from the Shimmer directory into your Xcode project:

    • FBShimmering.h
    • FBShimmering.m
    • FBShimmeringView.h
    • FBShimmeringView.m
    • FBShimmeringLayer.h
    • FBShimmeringLayer.m
  3. Ensure the files are added to your target in the "Build Phases" tab.

Configuration

No specific configuration files or environment variables are required for Shimmer. Simply import the necessary headers in your code:

#import "FBShimmeringView.h"

Build & Run

Local Development

  1. Open your project in Xcode:

    open YourProject.xcworkspace
    
  2. Add the shimmering effect to any view:

    // Create a shimmering view
    FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:shimmeringView];
    
    // Add content to the shimmering view
    UILabel *loadingLabel = [[UILabel alloc] initWithFrame:shimmeringView.bounds];
    loadingLabel.textAlignment = NSTextAlignmentCenter;
    loadingLabel.text = NSLocalizedString(@"Shimmer", nil);
    shimmeringView.contentView = loadingLabel;
    
    // Start shimmering
    shimmeringView.shimmering = YES;
    
  3. Build and run your app:

    • Select your target device or simulator
    • Press Cmd+R or click the Run button

Example Project

To explore the example project:

  1. Open FBShimmering.xcworkspace (not the .xcodeproj)
  2. Build and run the example to see various shimmering parameters and interactions

Deployment

Shimmer is a client-side library for iOS applications. Deploy your app containing Shimmer through:

  • App Store: Submit your app through App Store Connect
  • Enterprise Distribution: Use enterprise certificates for internal distribution
  • Ad Hoc: Distribute to specific devices for testing

Ensure your deployment target is iOS 6.0 or later.

Troubleshooting

Common Issues and Solutions

1. Build Errors After Installing Shimmer

Issue: Build fails with missing header files Solution:

  • Verify the .xcworkspace file is open (not .xcodeproj) if using CocoaPods
  • Check that all Shimmer source files are added to your target
  • Clean and rebuild: Cmd+Shift+K

2. Shimmering Effect Not Visible

Issue: Content appears but no shimmer animation Solution:

  • Ensure shimmering property is set to YES
  • Verify the view's frame is not zero-sized
  • Check that the content view is properly assigned

3. Performance Issues

Issue: Shimmering causes lag or high CPU usage Solution:

  • Limit the number of shimmering views on screen simultaneously
  • Adjust shimmer parameters (duration, direction) for optimal performance
  • Test on actual devices, as simulators may show different performance characteristics

4. Compatibility Issues

Issue: App crashes on iOS versions below 6.0 Solution:

  • Set your deployment target to iOS 6.0 or later
  • Add runtime checks if supporting multiple iOS versions

5. Example Project Won't Build

Issue: Example project fails to compile Solution:

  • Open FBShimmering.xcworkspace instead of .xcodeproj
  • Ensure CocoaPods is installed and run pod install in the example directory

For additional help, check the original GitHub repository issues or consult Apple's documentation on Core Animation and CALayer masking.