// // KMHomeQuickToolsWindowController.swift // PDF Reader Pro // // Created by lizhe on 2023/10/31. // import Cocoa typealias KMHomeQuickToolsWindowControllerDataDidChange = (_ controller: KMHomeQuickToolsWindowController) ->Void class KMHomeQuickToolsWindowController: NSWindowController { @IBOutlet weak var collectionView: KMHomeQuickToolsCollectionView! static var sharedHomeQuickTools: KMHomeQuickToolsWindowController = KMHomeQuickToolsWindowController.init(windowNibName: NSNib.Name("KMHomeQuickToolsWindowController")) var dataChange: KMHomeQuickToolsWindowControllerDataDidChange? override func windowDidLoad() { self.window?.title = NSLocalizedString("Advanced Editing Tools", comment: "") let showType = KMQucikToolsModel.showType() var showTypeArray: [NSNumber] = [] for index in showType { showTypeArray.append(index.rawValue as NSNumber) } let hiddenType = KMQucikToolsModel.hiddenType() var hiddenTypeArray: [NSNumber] = [] for index in hiddenType { hiddenTypeArray.append(index.rawValue as NSNumber) } collectionView.showData(showArr: showTypeArray, hideArr: hiddenTypeArray) collectionView.dataChange = { [unowned self] view, showData in KMQucikToolsModel.saveShowType(data: showData) guard let callBack = self.dataChange else { return } callBack(self) } } }