# Fixes warning `Your project does not explicitly specify the CocoaPods master specs repo`.
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '13.0'
use_frameworks!

target 'Example' do
  pod 'GradientLoadingBar', :path => '../', :testspecs => ['Tests']

  # Development pods.
  pod 'SwiftFormat/CLI', '~> 0.41'
  pod 'SwiftLint', '~> 0.42'
  pod 'SwiftConfigurationFiles', :git => 'https://github.com/fxm90/SwiftConfigurationFiles.git'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if target.name == 'GradientLoadingBar'
          # Explicitly set the iOS deployment target for `GradientLoadingBar` in our pods project, as this will be read by Carthage.
          #
          # - Note: This value has to match `s.ios.deployment_target` from the `.podspec` file!!
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
        else
          # Remove the deployment target from all other pods in our project and let them inherit
          # the project/workspace deployment target that has been specified at the top of the Podfile.
          # Source: https://stackoverflow.com/a/63489366
          config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
        end
      end
    end

    #
    # Fix issues with interface builder and CocoaPods.
    #
    # Source: https://github.com/CocoaPods/CocoaPods/issues/7606#issuecomment-484294739
    #
    installer.pods_project.build_configurations.each do |config|
      next unless config.name == 'Debug'

      config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [
        '$(FRAMEWORK_SEARCH_PATHS)'
      ]
    end
  end
end