Search code examples
cocoapods

How to define the swift version for a specific pod in a Podfile


Is it possible to set swift version compiler to version 3.0 for the pod named 'SideMenuController' in the Podfile below? If yes, then how to do it?

use_frameworks!
platform :ios, '10.0'

def shared_pods

    pod 'Alamofire', '4.6.0'
    pod 'SideMenuController', '0.2.4'

end

Solution

  • post_install do |installer|
            installer.pods_project.build_configurations.each do |config|
                config.build_settings.delete('CODE_SIGNING_ALLOWED')
                config.build_settings.delete('CODE_SIGNING_REQUIRED')
            end
            installer.pods_project.targets.each do |target|
                if ['SideMenuController'].include? target.name
                    target.build_configurations.each do |config|
                        config.build_settings['SWIFT_VERSION'] = '3.0'
                    end
                end
            end
    end