I use public
to declare type of Enum, I understand its the common base class of all Java language enumeration types.
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
}
Works locally I may add.
App/Features/Search/Controller/SearchController.swift:91:19: enum case ‘fromPost’ not found in type ‘Destiny’
Well, the problem is that destinySearch
is an optional
so the value theoretically is nil
, unless you’re using the Null coalescing operator
, so to get back on track, it’s actually expecting:
case .fromPost?:
Instead of:
case .fromPost:
To make this more clear, the types of shortForm
and longForm
in this snippet I created are the same:
let shortForm: Int? = Int("1")
let longForm: Optional<Int> = Int("2")
You may unwrap it before, or you can declare the destinySearch
as an implicitly unwrapped value. Moving onto Travis, please make sure you’re using the latest version of Xcode via:
osx_image: xcode12.2
Use this table as a reference when selecting an Xcode version: https://docs.travis-ci.com/user/reference/osx/