Moves selection to SidebarModel

This commit is contained in:
Stuart Breckenridge
2020-07-09 07:15:47 +08:00
parent 91bc4a0c30
commit 4c11667ff7
4 changed files with 26 additions and 50 deletions

View File

@@ -20,6 +20,28 @@ class SidebarModel: ObservableObject {
@Published var sidebarItems = [SidebarItem]()
#if os(macOS)
@Published var selectedSidebarItems = Set<FeedIdentifier>() {
didSet {
print(selectedSidebarItems)
}
}
#endif
private var items = Set<FeedIdentifier>()
@Published var selectedSidebarItem: FeedIdentifier? = .none {
willSet {
#if os(macOS)
if newValue != nil {
items.insert(newValue!)
} else {
selectedSidebarItems = items
items.removeAll()
}
#endif
}
}
init() {