-
Notifications
You must be signed in to change notification settings - Fork 16
/
OutlinePreviewVC.swift
36 lines (30 loc) · 902 Bytes
/
OutlinePreviewVC.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Cocoa
class OutlinePreviewVC: NSViewController {
/// File to render
let file: File
required convenience init(file: File) {
self.init(nibName: nil, bundle: nil, file: file)
}
init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?, file: File) {
self.file = file
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func loadView() {
// Required because the view controller is not initialized using a Storyboard
view = NSView()
}
func loadData(fileTree: FileTree, labelText: String?) {
let outlineView = OutlinePreviewView(
frame: view.frame,
fileTree: fileTree,
labelText: labelText
)
outlineView.autoresizingMask = [.height, .width]
view.addSubview(outlineView)
outlineView.expandFirstLevel()
}
}