I have a filter that I am trying to use to compare one value to another. Here is the enum that I am using:
enum SomeEnum: String {
case first = "Hey"
case second = "There"
case third = "Peace"
static let values = [first, second, third]
func pickOne() -> String {
switch self {
case .first:
return "value 1"
case .second:
return "value 2"
case .third:
return "value 3"
}
}
Here is where I am attempting to filter and find matching values:
array.append(SomeEnum.values.filter({$0.rawValue == anotherArray["id"] as! String}))
I end up getting an ambiguous error:
Cannot convert value of type '[SomeEnum]' to expected argument type 'String'
Any ideas?
array?anotherArray? You're trying to subscript it like a dictionary