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)
-
Install CocoaPods if not already installed:
sudo gem install cocoapods -
Create a
Podfilein your project directory:platform :ios, '6.0' pod 'Shimmer', '~> 1.0' -
Run the following command to install:
pod install -
Open your project's
.xcworkspacefile instead of.xcodeprojfrom now on.
Option 2: Manual Installation
-
Clone the repository:
git clone https://github.com/facebook/Shimmer.git -
Drag the following files from the
Shimmerdirectory into your Xcode project:FBShimmering.hFBShimmering.mFBShimmeringView.hFBShimmeringView.mFBShimmeringLayer.hFBShimmeringLayer.m
-
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
-
Open your project in Xcode:
open YourProject.xcworkspace -
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; -
Build and run your app:
- Select your target device or simulator
- Press
Cmd+Ror click the Run button
Example Project
To explore the example project:
- Open
FBShimmering.xcworkspace(not the.xcodeproj) - 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
.xcworkspacefile 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
shimmeringproperty is set toYES - 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.xcworkspaceinstead of.xcodeproj - Ensure CocoaPods is installed and run
pod installin the example directory
For additional help, check the original GitHub repository issues or consult Apple's documentation on Core Animation and CALayer masking.