KMConvertBaseView.swift 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // KMConvertBaseView.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/5/11.
  6. //
  7. import Cocoa
  8. // 转档视图基类
  9. class KMConvertBaseView: NSView, NibLoadable {
  10. override func draw(_ dirtyRect: NSRect) {
  11. super.draw(dirtyRect)
  12. // Drawing code here.
  13. }
  14. static var nibName: String? {
  15. return "KMConvertBaseWindowController"
  16. }
  17. static func createFromNib(in bundle: Bundle = Bundle.main) -> Self? {
  18. guard let nibName = nibName else { return nil }
  19. var topLevelArray: NSArray? = nil
  20. bundle.loadNibNamed(NSNib.Name(nibName), owner: nil, topLevelObjects: &topLevelArray)
  21. guard let results = topLevelArray else { return nil }
  22. let views = Array<Any>(results).filter { $0 is Self }
  23. return views.last as? Self
  24. }
  25. override func awakeFromNib() {
  26. super.awakeFromNib()
  27. self.initSubViews()
  28. self.initDefaultVlaue()
  29. }
  30. func initDefaultVlaue() {}
  31. func initSubViews() {}
  32. }