aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift8
1 files changed, 8 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
index 5ceb2a1b..310d13ab 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
@@ -61,6 +61,7 @@ class TunnelsListTableViewController: NSViewController {
override func loadView() {
tableView.dataSource = self
tableView.delegate = self
+ selectFirstTunnel()
let scrollView = NSScrollView()
scrollView.hasVerticalScroller = true
@@ -148,6 +149,13 @@ class TunnelsListTableViewController: NSViewController {
@objc func exportTunnelsClicked() {
print("exportTunnelsClicked")
}
+
+ @discardableResult
+ private func selectFirstTunnel() -> Bool {
+ guard tunnelsManager.numberOfTunnels() > 0 else { return false }
+ tableView.selectRowIndexes(IndexSet(integer: 0), byExtendingSelection: false)
+ return true
+ }
}
extension TunnelsListTableViewController: NSTableViewDataSource {