0

I have an enum:

enum StoresSortType {
    case address, number, lastInspectionDate, distance(CLLocation)
}

I want to check only case without parameters, like that:

 let type = StoresSortType.address
 if lastSorting.type == type {
     //logic here
 }

But I have an error: path_to_file.swift:197:69: Binary operator '==' cannot be applied to two 'StoresSortType' operands

How I can do that with ignoring of CLLocation parameter in last case?

1

1 Answer 1

0

You could use a switch statement

switch( lastSorting )
{
 case .distance:
 break
 default:
 break
}
Sign up to request clarification or add additional context in comments.

1 Comment

And how I can compare it with type?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.