diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift index d6f7126..709464c 100644 --- a/WireGuard/WireGuard/UI/TunnelViewModel.swift +++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift @@ -10,7 +10,7 @@ import UIKit class TunnelViewModel { - enum InterfaceEditField: String { + enum InterfaceField: String { case name = "Name" case privateKey = "Private key" case publicKey = "Public key" @@ -21,7 +21,7 @@ class TunnelViewModel { case dns = "DNS servers" } - enum PeerEditField: String { + enum PeerField: String { case publicKey = "Public key" case preSharedKey = "Pre-shared key" case endpoint = "Endpoint" @@ -32,11 +32,11 @@ class TunnelViewModel { } class InterfaceData { - var scratchpad: [InterfaceEditField: String] = [:] - var fieldsWithError: Set = [] + var scratchpad: [InterfaceField: String] = [:] + var fieldsWithError: Set = [] var validatedConfiguration: InterfaceConfiguration? = nil - subscript(field: InterfaceEditField) -> String { + subscript(field: InterfaceField) -> String { get { if (scratchpad.isEmpty) { // When starting to read a config, setup the scratchpad. @@ -148,15 +148,15 @@ class TunnelViewModel { class PeerData { var index: Int - var scratchpad: [PeerEditField: String] = [:] - var fieldsWithError: Set = [] + var scratchpad: [PeerField: String] = [:] + var fieldsWithError: Set = [] var validatedConfiguration: PeerConfiguration? = nil init(index: Int) { self.index = index } - subscript(field: PeerEditField) -> String { + subscript(field: PeerField) -> String { get { if (scratchpad.isEmpty) { // When starting to read a config, setup the scratchpad. diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index a98ae81..bdea868 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -12,13 +12,13 @@ import UIKit class TunnelEditTableViewController: UITableViewController { - let interfaceEditFieldsBySection: [[TunnelViewModel.InterfaceEditField]] = [ + let interfaceEditFieldsBySection: [[TunnelViewModel.InterfaceField]] = [ [.name], [.privateKey, .publicKey, .generateKeyPair], [.addresses, .listenPort, .mtu, .dns] ] - let peerEditFieldsBySection: [[TunnelViewModel.PeerEditField]] = [ + let peerEditFieldsBySection: [[TunnelViewModel.PeerField]] = [ [.publicKey, .preSharedKey, .endpoint, .allowedIPs, .excludePrivateIPs, .persistentKeepAlive,