swiftcocoapodsswift4uifontdescriptor

'pod spec lint' fails after project conversion to Swift 4


After converting my cocoa framework project to Swift 4 the class UIFontDescriptorFamilyAttribute is now UIFontDescriptor.AttributeName.family, so I changed my code from:

// Swift 3    
UIFontDescriptor(fontAttributes: [UIFontDescriptorFamilyAttribute: fontFamiliy])

to

// Swift 4
UIFontDescriptor(fontAttributes: [UIFontDescriptor.AttributeName.family: fontFamiliy])

However, when I try -pod spec lint- I get next error:

- ERROR | [iOS] xcodebuild:  SerializableLabel.swift:108:68: error: type 'UIFontDescriptor' has no member 'AttributeName'

Is cocoapods somehow not aware yet of Swift 4? Do I have to update something else in my configuration?

My config:

.podspec

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }

cocoapods

$ pod --version
1.3.1

Solution

  • Try to make a file named .swift-version and inside just put 4.0

    Update for Cocoapods >= 1.5

    you now use s.swift_version = '4.1' in your podspec