pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.32k stars 184 forks source link

The content in .swift-version file, which was deprecated in CocoaPods 1.7.0, should be moved to .podspec file #61

Closed superwave closed 4 years ago

superwave commented 4 years ago

while using CocoaPods version > 1.7.0, the below code in PodFile to support swift version will not work and get error when pod install.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '4.2'
        end
    end
end

The CocoaPods blog says that CocoaPods 1.7.0 deprecated the .swift-version file, the swift_version should be moved to .podspec file,

Deprecating .swift-version File

Up until now, most pod authors have been relying on specifying a .swift-version file at the root of their repo in order to successfully publish their pod with the Swift version they officially support. However, this information is never transcribed within the published podspec and therefore during integration none of it is taken into consideration when choosing which Swift version to use.

This can cause numerous issues especially when a new version of Swift is released. This is because a consumer will automatically pick the latest version of Swift to use without the pod author officially claiming that it is supported.

We strongly recommend pod authors to migrate over to use the officially supported swift_version DSL within their podspec instead.

We also recommend deleting the .swift-version file in your repo unless you use it for other tools such as swiftenv. The swift_version DSL will always take precedence over the .swift-version file.

Finally, a warning will be displayed during lint that encourages pod authors to migrate away from using the .swift-version file and in a future major release of CocoaPods we plan to completely remove support for it.

http://blog.cocoapods.org/CocoaPods-1.7.0-beta/

maybe adding this line in .podspec will helps:

s.swift_version = '4.2'

pmusolino commented 4 years ago

Hi @superwave. Thanks for this suggestion. I'll do it in the next release.

pmusolino commented 4 years ago

Implemented here https://github.com/pmusolino/Wormholy/pull/79