0
votes

I'm trying to update a dependency I have in one of my Swift 3 pods. The dependency in question is Socket.IO-Client-Swift. I want to upgrade it from the Swift 3 version to the latest Swift 4 version.

It works fine in Xcode if I set the "Swift Language Version" for the Socket.IO-Client pod to 4.1. It builds with no issues.

When I try to lint the podspec or push the podspec I get errors because it looks like it's trying to compile Socket.IO using Swift 3.

ERROR | [iOS] xcodebuild: Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:111:39: error: cannot call value of non-function type 'Bool'

...

ERROR | [iOS] xcodebuild: Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:471:39: error: cannot call value of non-function type 'Bool'

Is there anyway to get cocoapods to compile a dependency (Socket.IO-Client-Swift) using Swift 4 while using Swift 3 for anything else that needs it?

2

2 Answers

0
votes

In your pod file add the below line specifying your pod-name

post_install do |installer|
installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        if target.name == 'Your-Pod-Name'
            config.build_settings['SWIFT_VERSION'] = '4.0' //use required pod version here
        end            
    end
end 

end

Once done, run the command 'pod install'

0
votes

add s.swift_version = "4.0" to your podspec file.

If you did not declear which swift version your pod is using, Cocoapods will set it to the version you are using in your project