aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-25 08:00:12 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-27 15:13:02 +0530
commit112b5c3b109e6c9a8c5ab3101567e250da53b1fe (patch)
tree4034758a9f65ae24dd1c048817149e8c6f335ce7 /WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
parentParser: Interface name can be added after parsing (diff)
downloadwireguard-apple-112b5c3b109e6c9a8c5ab3101567e250da53b1fe.tar.xz
wireguard-apple-112b5c3b109e6c9a8c5ab3101567e250da53b1fe.zip
Tunnel editing: Separate init for creation and modification
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift15
1 files changed, 13 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
index e3efc50..1c863f5 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
@@ -29,10 +29,21 @@ class TunnelEditTableViewController: UITableViewController {
let tunnel: TunnelContainer?
let tunnelViewModel: TunnelViewModel
- init(tunnelsManager tm: TunnelsManager, tunnel t: TunnelContainer? = nil) {
+ init(tunnelsManager tm: TunnelsManager, tunnel t: TunnelContainer) {
+ // Use this initializer to edit an existing tunnel.
tunnelsManager = tm
tunnel = t
- tunnelViewModel = TunnelViewModel(tunnelConfiguration: t?.tunnelConfiguration)
+ tunnelViewModel = TunnelViewModel(tunnelConfiguration: t.tunnelConfiguration)
+ super.init(style: .grouped)
+ self.modalPresentationStyle = .formSheet
+ }
+
+ init(tunnelsManager tm: TunnelsManager, tunnelConfiguration: TunnelConfiguration?) {
+ // Use this initializer to create a new tunnel.
+ // If tunnelConfiguration is passed, data will be prepopulated from that configuration.
+ tunnelsManager = tm
+ tunnel = nil
+ tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnelConfiguration)
super.init(style: .grouped)
self.modalPresentationStyle = .formSheet
}