From e00a577bba288e139ea725e5b9b3140fb57e88bd Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 17 Oct 2018 15:33:06 +0530 Subject: [PATCH] Tunnels list: Show an actions list when the '+' is tapped --- .../UI/iOS/TunnelsListTableViewController.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index 6fb7799..f9c7ff4 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -36,7 +36,20 @@ class TunnelsListTableViewController: UITableViewController { } @objc func addButtonTapped(sender: UIBarButtonItem!) { - print("Add button tapped") + let alert = UIAlertController(title: "", + message: "Add a tunnel", + preferredStyle: .actionSheet) + alert.addAction( + UIAlertAction(title: "Create from scratch", style: .default) { (action) in + print("Write") + } + ) + alert.addAction( + UIAlertAction(title: "Cancel", style: .cancel) + ) + // popoverPresentationController will be nil on iPhone and non-nil on iPad + alert.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem + self.present(alert, animated: true, completion: nil) } }