Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift_version in the Podspec isn't reflected in the generated Xcode project(s) #148

Open
Buzz-Lightyear opened this issue Mar 8, 2022 · 3 comments

Comments

@Buzz-Lightyear
Copy link

My Pod requires Swift 5 to compile and I set it in the Podspec:

  s.swift_version = '5.0'

However, the generated Xcode project still sets the version to 4.0:

smuthu in ~/Sandbox/ios-video-player on branch master >grep 'SWIFT_VERSION = 4.0' ./ -r --color=auto -n
...
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9874:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9916:				SWIFT_VERSION = 4.0;
...
.//GeneratedWorkspace/Workspace/Workspace.xcodeproj/project.pbxproj:287:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Workspace.xcodeproj/project.pbxproj:374:				SWIFT_VERSION = 4.0;

I was able to run

find . -name '*.pbxproj' -print0 | xargs -0 sed -i "" "s/SWIFT_VERSION\ =\ 4.0/SWIFT_VERSION\ =\ 5.0/g"

and confirmed that my targets build correctly.

cocoapods-generate should respect the swift_version flag and reflect it in the generated Xcode projects.

@Buzz-Lightyear
Copy link
Author

I apologize, the setting actually comes from our plugins.

@Buzz-Lightyear Buzz-Lightyear reopened this Mar 8, 2022
@Buzz-Lightyear
Copy link
Author

Actually, I take that back. I ran pod gen and the Swift version is definitely set to 4.0 before our plugins do anything:

smuthu in ~/Sandbox/ios-video-player on branch master >pod gen LIVideoPlayer.podspec LIVideoPlayerGoogleCastPlayback.podspec [email protected]:multiproduct/podspec-repo.git --local-sources=./ --gen-directory=GeneratedWorkspace --clean --repo-update --single-workspace --auto-open
I, [2022-03-08T11:43:35.229056 #43257]  INFO -- : Running mint dependency create-dependency-spec --overwrite to create default dependency spec

Updating specs repos
Updating spec repo `githubprivate-multiproduct-podspec-repo`

Generating workspace in `GeneratedWorkspace/Workspace`
    $ /usr/bin/open /Users/smuthu/Sandbox/ios-video-player/GeneratedWorkspace/Workspace/Workspace.xcworkspace
smuthu in ~/Sandbox/ios-video-player on branch master >grep 'SWIFT_VERSION = 4.0' ./ -r --color=auto -n
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9856:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9891:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9925:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9960:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:9994:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10029:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10064:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10100:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10170:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10206:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10241:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10277:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10312:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10348:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10383:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10419:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10454:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10490:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10793:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10829:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10863:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10898:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10933:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:10969:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:11003:				SWIFT_VERSION = 4.0;
.//GeneratedWorkspace/Workspace/Pods/Pods.xcodeproj/project.pbxproj:11038:				SWIFT_VERSION = 4.0;

@aryamansharda
Copy link

We're having the same issue with one of our local Pods.

We've specified our preferred Swift version in the Podfile for our new dependency and while it honors that, it doesn't carry over to the spec's dependency. In other words, AnimationViewWrapper is correctly set to Swift 5, but lottie-ios is still Swift 4.

Pod::Spec.new do |spec|
  spec.name = "AnimationViewWrapper"
  spec.version = "0.1"
   ....
  spec.license = { type: "Private" }
  spec.homepage = "..."
  spec.summary = "A wrapper around Lottie for animations."
  spec.source = { git: "..." }
  spec.swift_version = '5'
  spec.source_files = [
    "Sources/**/*.swift"
  ]
  spec.ios.deployment_target = '15.0'
  spec.watchos.deployment_target = '7.0'
  spec.platform = :ios, '15.0'
  spec.dependency 'lottie-ios', '3.4.1'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants