CustomView.xibを作る CustomView.swiftを作ってCustomView: NSViewクラスを作る xibのViewのCustom ClassにCustomViewを設定する let nib = NSNib(nibNamed: "CustomView", bundle: Bundle.main)! var topLevelArray: NSArray? = nil guard nib.instantiate(withOwner: nil, topLevelObjects: &topLevelArray), let results = topLevelArray as? [Any], let item = results.last(where: { $0 is CustomView }), let customView = item as? CustomView e