KMNBaseViewController.swift 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // KMNBaseViewController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/5/5.
  6. //
  7. import Cocoa
  8. class KMNBaseViewController: NSViewController {
  9. deinit {
  10. KMPrint(self.className + " deinit.")
  11. self.removeNotifations()
  12. }
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. initContentView()
  16. self.addNotifations()
  17. }
  18. // Noti
  19. func addNotifations() {
  20. updateUIThemeColor()
  21. NotificationCenter.default.addObserver(self, selector: #selector(updateUIThemeColor), name: APPAppearanceChangedNotificationName, object: nil)
  22. updateUILanguage()
  23. NotificationCenter.default.addObserver(self, selector: #selector(updateUILanguage), name: APPLanguageChangedNotificationName, object: nil)
  24. }
  25. func removeNotifations() {
  26. NotificationCenter.default.removeObserver(self)
  27. }
  28. @objc func updateUIThemeColor() {}
  29. @objc func updateUILanguage() {}
  30. func initContentView() {}
  31. }