Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ final class SplitViewController {

/// Callback for geometry changes
var onGeometryChange: (() -> Void)?

let animator: SplitAnimator = SplitAnimator()

init(rootNode: SplitNode? = nil) {
if let rootNode {
Expand Down
5 changes: 1 addition & 4 deletions Sources/Bonsplit/Internal/Utilities/SplitAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ final class SplitAnimator {
private var displayLink: CVDisplayLink?
private var animations: [UUID: Animation] = [:]

/// Shared animator instance
static let shared = SplitAnimator()

/// Animation duration in seconds
nonisolated static let animationDuration: CFTimeInterval = 0.16
// MARK: - Initialization

private init() {
package init() {
setupDisplayLink()
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Bonsplit/Internal/Views/SplitContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ struct SplitContainerView<Content: View, EmptyContent: View>: NSViewRepresentabl
splitState.dividerPosition = 0.5

// Wait for layout
DispatchQueue.main.async {
Task {
Copy link
Contributor Author

@SplittyDev SplittyDev Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change isn't technically required for the fix, but it's good practice to use structured concurrency instead of GCD nowadays. The Task inherits the MainActor from NSViewRepresentable, so this is perfectly safe to do.

// Show the new pane and animate
splitView.arrangedSubviews[newPaneIndex].isHidden = false

SplitAnimator.shared.animate(
controller.animator.animate(
splitView: splitView,
from: startPosition,
to: targetPosition
Expand Down