@@ -143,6 +143,14 @@ struct WorkspaceSplitView: NSViewControllerRepresentable {
143
143
final class CustomSplitView : NSSplitView {
144
144
override var dividerThickness : CGFloat { StatusBarView . height }
145
145
override var dividerColor : NSColor { . clear }
146
+
147
+ private var statusBar = NSHostingView ( rootView: StatusBarView ( ) )
148
+
149
+ override func drawDivider( in rect: NSRect ) {
150
+ addSubview ( statusBar)
151
+ statusBar. frame = rect
152
+ statusBar. needsDisplay = true
153
+ }
146
154
}
147
155
148
156
final class WorkspaceViewController : NSSplitViewController {
@@ -156,20 +164,6 @@ struct WorkspaceSplitView: NSViewControllerRepresentable {
156
164
fatalError ( " init(coder:) has not been implemented " )
157
165
}
158
166
159
- override func viewDidLoad( ) {
160
- super. viewDidLoad ( )
161
- let dividerView = NSHostingView ( rootView: StatusBarView ( ) )
162
- dividerView. translatesAutoresizingMaskIntoConstraints = false
163
- let constraints = [
164
- // dividerView.topAnchor.constraint(equalTo: splitView.subviews[0].bottomAnchor),
165
- dividerView. bottomAnchor. constraint ( equalTo: splitView. subviews [ 1 ] . topAnchor) ,
166
- dividerView. leadingAnchor. constraint ( equalTo: splitView. leadingAnchor) ,
167
- dividerView. trailingAnchor. constraint ( equalTo: splitView. trailingAnchor)
168
- ]
169
- splitView. addSubview ( dividerView)
170
- NSLayoutConstraint . activate ( constraints)
171
- }
172
-
173
167
func addPane( _ pane: some View ) {
174
168
let viewController = NSHostingController ( rootView: pane)
175
169
let splitViewItem = NSSplitViewItem ( viewController: viewController)
0 commit comments