Skip to main content

Adding Flipper to iOS apps

We support both Swift and Objective-C for Flipper with CocoaPods as build and distribution mechanism.


The following configuration assumed CocoaPods 1.9+.

project 'MyApp.xcodeproj'flipperkit_version = '0.108.0'
target 'MyApp' do  platform :ios, '10.0'
  # It is likely that you'll only want to include Flipper in debug builds,  # in which case you add the `:configuration` directive:  pod 'FlipperKit', '~>' + flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version, :configuration => 'Debug'  # ...unfortunately at this time that means you'll need to explicitly mark  # transitive dependencies as being for debug build only as well:  pod 'Flipper-DoubleConversion', :configuration => 'Debug'  pod 'Flipper-Folly', :configuration => 'Debug'  pod 'Flipper-Glog', :configuration => 'Debug'  pod 'Flipper-PeerTalk', :configuration => 'Debug'  pod 'CocoaLibEvent', :configuration => 'Debug'  pod 'boost-for-react-native', :configuration => 'Debug'  pod 'OpenSSL-Universal', :configuration => 'Debug'  pod 'CocoaAsyncSocket', :configuration => 'Debug'  # ...except, of course, those transitive dependencies that your  # application itself depends, e.g.:  pod 'ComponentKit', '~> 0.31'
  # If you use `use_frameworks!` in your Podfile,  # uncomment the below $static_framework array and also  # the pre_install section.  This will cause Flipper and  # it's dependencies to be built as a static library and all other pods to  # be dynamic.  #  # NOTE Doing this may lead to a broken build if any of these are also  #      transitive dependencies of other dependencies and are expected  #      to be built as frameworks.  #  # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',  #   'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',  #   'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',  #   'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']  #  # pre_install do |installer|  #   Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}  #   installer.pod_targets.each do |pod|  #       if $static_framework.include?(  #         def pod.build_type;  #           Pod::BuildType.static_library  #         end  #       end  #     end  # endend

For pure Objective-C projects#

For pure Objective-C projects, add the following things in your settings:

  1. /usr/lib/swift as the first entry of the LD_RUNPATH_SEARCH_PATHS
  2. Add the following in LIBRARY_SEARCH_PATHS
  1. If after the above two steps there are still error's like Undefined symbol _swift_getFunctionReplacement then set DEAD_CODE_STRIPPING to YES. Reference for this fix is here

This is done to overcome a bug with Xcode 11 which fails to compile swift code when bitcode is enabled. Flipper transitively depends on YogaKit which is written in Swift. More about this issue can be found here and here.

Install the dependencies by running pod install. You can now import and initialize Flipper in your AppDelegate.

#import <FlipperKit/FlipperClient.h>#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>#import <FlipperKitLayoutComponentKitSupport/FlipperKitLayoutComponentKitSupport.h>#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  FlipperClient *client = [FlipperClient sharedClient];  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];  [FlipperKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];  [client addPlugin: [[FlipperKitLayoutPlugin alloc] initWithRootNode: application                                                 withDescriptorMapper: layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];  [client addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];  [client start];  ...}@end

Enabling plugins#

Finally, you need to add plugins to your Flipper client. Above, we have only added the Layout Inspector plugin to get you started. See Network Plugin and Layout Inspector Plugin for information on how to add them, and also enable Litho or ComponentKit support. You can check the sample apps in the GitHub repo for examples of integrating other plugins.

Having trouble?#

See the troubleshooting page for help with known problems.