tangled
alpha
login
or
join now
jonmsterling.com
/
AquaKit
4
fork
atom
A collection of user interface components and drawing routines for building tasteful apps using AppKit.
appkit
swift
aqua
ui
mac
4
fork
atom
overview
issues
1
pulls
pipelines
Add SplitViewResizeCoordinator
jonmsterling.com
1 month ago
87d252ed
b7c57ce4
+18
1 changed file
expand all
collapse all
unified
split
Sources
AquaKit
Controls and Views
SplitViewResizeCoordinator.swift
+18
Sources/AquaKit/Controls and Views/SplitViewResizeCoordinator.swift
···
1
1
+
import AppKit
2
2
+
3
3
+
open class SplitViewResizeCoordinator: NSObject {
4
4
+
public var splitView: NSSplitView
5
5
+
public var dividerIndex: Int = 0
6
6
+
7
7
+
public init(splitView: NSSplitView) {
8
8
+
self.splitView = splitView
9
9
+
}
10
10
+
11
11
+
@MainActor
12
12
+
@objc public func resize(_ sender: AquaResizeHandle) {
13
13
+
guard let drag = sender.activeDrag else { return }
14
14
+
let subview = splitView.arrangedSubviews[dividerIndex]
15
15
+
let currentPosition = splitView.isVertical ? subview.frame.maxX : subview.frame.maxY
16
16
+
splitView.setPosition(currentPosition + drag.delta, ofDividerAt: dividerIndex)
17
17
+
}
18
18
+
}