project 'SampleSwift.xcodeproj' source 'https://github.com/facebook/Sonar.git' source 'https://github.com/CocoaPods/Specs' swift_version = "4.1" target 'SampleSwift' do platform :ios, '9.0' pod 'Flipper', :path => '../../Flipper.podspec' pod 'FlipperKit', :path => '../../FlipperKit.podspec' pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec' post_install do |installer| file_name = Dir.glob("*.xcodeproj")[0] app_project = Xcodeproj::Project.open(file_name) app_project.native_targets.each do |target| target.build_configurations.each do |config| if (config.build_settings['OTHER_SWIFT_FLAGS']) if !(config.build_settings['OTHER_SWIFT_FLAGS'].include? '-DFB_SONARKIT_ENABLED') puts 'Adding -DFB_SONARKIT_ENABLED ...' swift_flags = config.build_settings['OTHER_SWIFT_FLAGS'] if swift_flags.split.last != '-Xcc' config.build_settings['OTHER_SWIFT_FLAGS'] << ' -Xcc' end config.build_settings['OTHER_SWIFT_FLAGS'] << ' -DFB_SONARKIT_ENABLED' end else puts 'OTHER_SWIFT_FLAGS does not exist thus assigning it to `$(inherited) -Xcc -DFB_SONARKIT_ENABLED`' config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xcc -DFB_SONARKIT_ENABLED' end app_project.save end end end end