Update for Xcode 10.1 and Swift 4.2
Swift 3, 4, and 4.2 targets can coexist and link together.
You decide when and if you’d like to migrate on a per-target basis
when it makes sense for your project. While migrating to Swift 4.2 is
definitely encouraged, it’s not an all-or-nothing process, as Swift 3,
4, and 4.2 targets can coexist and link together.
Different cocoapod and different project version can also coexist.
You wish to have different cocoapod version as compared to your project version then you should make following changes at the end of your pod file:
post_install do |installer|
    print "Setting the default SWIFT_VERSION to 4.2\n"
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
    end
    installer.pods_project.targets.each do |target|
        if ['SomeTarget-iOS', 'SomeTarget-watchOS'].include? "#{target}"
            print "Setting #{target}'s SWIFT_VERSION to 3.0\n"
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.0'
            end
        else
            print "Setting #{target}'s SWIFT_VERSION to Undefined (Xcode will automatically resolve)\n"
            target.build_configurations.each do |config|
                config.build_settings.delete('SWIFT_VERSION')
            end
        end
    end
end
Sometimes even after you run pod update your xcode forcefully update your cocoapod's project version, then in that case select cocoapod pod project and change the swift version in the build settings.