Search code examples
swiftxcodetravis-cifastlanepbxproj

Enum case 'fromPost' not found in type 'Destiny?' in Travis, but the type is declared in File


I declare type of Enum

public enum Destiny {
    case fromTrail
    case fromPost
}

And use in another part of code, like that:

 convenience init(withDestinySearch from: Destiny) {
        self.init(collectionViewLayout: UICollectionViewFlowLayout())
        destinySearch = from
    }

But this error appear in build of Travis, and just in Travis CI: Sigma/Sigma/App/Features/Search/Controller/SearchController.swift:92:15: enum case 'fromPost' not found in type 'Destiny?'

This is build: https://travis-ci.org/ViniciusDeep/Sigma/builds/604199159?utm_source=github_status&utm_medium=notification


Solution

  • Well, the problem is that destinySearch is an optional, so it's actually expecting:

    case .fromPost?:
    

    instead of:

    case .fromPost:
    

    Or you may unwrap it before, or you can declare the destinySearch as implicitly unwrapped value.

    About Travis; it could be about the fact that it's using Xcode 10.3, because I can compile/run it successfully in my own Xcode (11.0).