Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61840

How to set up versions for specific pods in Podfile?

This is what I do in my Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |pod|
        pods = { 'CDMarkdownKit': '4.0', 'MessageKit': '4.0', 'LocalizationKit': '4.0', 'RxKeyboard': '4.0', 'JWTDecode': '3.1'}
            if pods.keys.include?(pod.name)
                pod.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = pods[pod.name]
                end
            end
        end
    end
end

But this doesn't work. I don't know why. What is wrong here?

Upvotes: 1

Views: 602

Answers (1)

Kamil Walas
Kamil Walas

Reputation: 43

You should use symbols against values. Updated code is below:

post_install do |installer|
    installer.pods_project.targets.each do |pod|
        pods = {'CDMarkdownKit': '4.0', 'MessageKit': '4.0', 'LocalizationKit': '4.0', 'RxKeyboard': '4.0', 'JWTDecode': '3.1'}
        if pods.has_key?(pod.name.to_sym)
            pod.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = pods.values_at(pod.name.to_sym)
            end
        end
    end
end

Upvotes: 1

Related Questions