mirror of
https://github.com/somegeekintn/SimDirs.git
synced 2026-03-25 08:55:54 +00:00
Persist source filter options.
This commit is contained in:
parent
7a80a94166
commit
ec7d268010
2 changed files with 10 additions and 2 deletions
|
|
@ -34,5 +34,13 @@ struct SourceFilter {
|
|||
}
|
||||
|
||||
var searchTerm = ""
|
||||
var options = Options()
|
||||
var options = Options() { didSet { UserDefaults.standard.set(options.rawValue, forKey: "FilterOptions") } }
|
||||
|
||||
static func restore() -> SourceFilter {
|
||||
var filter = SourceFilter()
|
||||
|
||||
filter.options = SourceFilter.Options(rawValue: UserDefaults.standard.integer(forKey: "FilterOptions"))
|
||||
|
||||
return filter
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class SourceState: ObservableObject {
|
|||
}
|
||||
|
||||
@Published var style = Style.placeholder { didSet { rebuildBase() } }
|
||||
@Published var filter = SourceFilter() { didSet { applyFilter() } }
|
||||
@Published var filter = SourceFilter.restore() { didSet { applyFilter() } }
|
||||
@Published var selection : UUID?
|
||||
|
||||
var model : SimModel
|
||||
|
|
|
|||
Loading…
Reference in a new issue