diff --git a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift index 9aa90140e..a2d735746 100644 --- a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift +++ b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift @@ -43,6 +43,7 @@ import RSCore NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) outlineView.reloadData() @@ -101,6 +102,14 @@ import RSCore configureCellsForRepresentedObject(feed) } + @objc func displayNameDidChange(_ note: Notification) { + + guard let object = note.object else { + return + } + configureCellsForRepresentedObject(object as AnyObject) + } + // MARK: Actions @IBAction func delete(_ sender: AnyObject?) { diff --git a/Technotes/CodingGuidelines.md b/Technotes/CodingGuidelines.md index f2760432a..3d58962d7 100644 --- a/Technotes/CodingGuidelines.md +++ b/Technotes/CodingGuidelines.md @@ -112,12 +112,14 @@ Stack views are not allowed in table and outline view cells, but they can be use Use nil-targeted actions and the responder chain when appropriate. -Use Cocoa bindings extremely rarely — for a checkbox in a preferences window, for instance. `NSArrayController` and similar are never used. Binding via code is also not done. +Use Cocoa bindings extremely rarely — for a checkbox in a preferences window, for instance. ### Notifications and Bindings Key-Value Observing (KVO) is entirely forbidden. KVO is where the crashing bugs live. (The only possible exception to this is when an Apple API requires KVO, which is rare.) +`NSArrayController` and similar are never used. Binding via code is also not done. + Instead, we use NotificationCenter notifications, and we use Swift’s `didSet` method on accessors. All notifications must be posted on the main queue.