How to handle Swift version with Cocoapods

Issue #80

Today I was migrating Imaginary to Swift 4. But I get

1
2
3
4
5
- ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code.
- ERROR | [OSX] xcodebuild: Cache/Source/Mac/NSImage+Extensions.swift:32:64: error: 'png' has been renamed to 'PNG'
- NOTE | [OSX] xcodebuild: AppKit.NSBitmapImageRep:57:27: note: 'png' was introduced in Swift 4
- ERROR | [OSX] xcodebuild: Cache/Source/Mac/NSImage+Extensions.swift:32:71: error: 'jpeg' has been renamed to 'JPEG'
- NOTE | [OSX] xcodebuild: AppKit.NSBitmapImageRep:52:27: note: 'jpeg' was introduced in Swift 4

swift4 png

The project is configured to use Swift 4 and its dependency Cache correctly uses .png and .jpeg https://github.com/hyperoslo/Cache/blob/master/Source/Mac/NSImage%2BExtensions.swift

Why is that 🤔

It turns out that the .swift-version is still showing 3.0. Change it to 4.0 fixes the issue. The .swift-version is a hint to specify which Swift version should be used for a pod https://github.com/CocoaPods/CocoaPods/pull/5841

Comments