Skip to content

Instantly share code, notes, and snippets.

@vhart
Created June 9, 2018 03:10
Show Gist options
  • Save vhart/5622d3190c460fee7cdba0c16f65cf33 to your computer and use it in GitHub Desktop.
Save vhart/5622d3190c460fee7cdba0c16f65cf33 to your computer and use it in GitHub Desktop.
enum FilterValue {
case string(String)
case bool(Bool)
func matches(value: Any) -> Bool {
switch self {
case .string(let stringValue):
return (value as? String) == stringValue
case .bool(let boolValue):
return (value as? Bool) == boolValue
}
}
}
enum FilterQuery {
case none
case filters([String: FilterValue]) //[Key: FilterValue]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment