Closed
Bug 1128612
Opened 10 years ago
Closed 7 years ago
Make QueryOptions into a simple dict
Categories
(Firefox for iOS :: Data Storage, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: wesj, Unassigned)
References
Details
I originally added a QueryOptions struct in the data code to handle filters, sorts, etc in a pretty generic way. I now kinda wish it was even more generic. i.e. we should be able to just pass a simple dict [String: AnyObject?]. We can use some predefined keys for basic things (SortKey, FilterKey, SortDirKey, etc). That makes it easier to include one-off prefs like "this history query should include favicon data") without cluttering up QueryOptions with it.
Comment 1•10 years ago
|
||
If possible then I would make it more formal than [String:AnyObject] (Why AnyObject? - can options be nil?)
Every time we use AnyObject we bypass Swift's features to write really strict and predictable code. I'm not saying there are no use cases for AnyObject, but we should avoid it as much as possible I think.
How about using an Enum with associated values? You could do something like:
enum QueryOption {
case IncludeFavicons(Bool)
case SortKey(String)
case FilterKey(String)
}
typealias QueryOptions = [QueryOption]
Updated•7 years ago
|
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•