Search code examples
ioscocoapodsswift4xcode9swiftlint

SwiftLint: Could not cast value of type 'Swift.Int64' to 'Swift.String', Build SwiftLint


I am integrating Swiftlint with my project in Xcode 9, Swift 4.

I installed swiftlint with Cocoapods. My Podfile looks like this:

# Uncomment the next line to define a global platform for your project
 platform :ios, '10.0'

target 'my_target' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    # Pods for my_target

    # https://github.com/Alamofire/Alamofire
    pod 'Alamofire'

    # https://fabric.io/kits/ios
    pod 'Fabric'

    # https://github.com/realm/SwiftLint
    pod 'SwiftLint'

end

When trying to build the project I see this error:

Could not cast value of type 'Swift.Int64' (0x10ff35f80) to 'Swift.String' (0x10ff3c4d8).

The version installed in pods is 0.25.1 Why is this happening?


Solution

  • Most likely you are on the wrong version of SwiftLint.

    As of this writing the latest version is 0.25.1

    You can see the latest version here: https://github.com/realm/SwiftLint/releases

    To see which version you are running: swiftlint version

    SwiftLint is NOT installed via CocoaPods!

    To upgrade to latest version:

    • Delete SwiftLint: brew uninstall swiftlint

    • Install SwiftLint: brew install swiftlint