I have a VPN app I am building, I also have my own DNS servers.
To specify what DNS I want to use I do it in the file VPNUK1.swift
under let dns = "1.1.1.1,8.8.8.8"
I have made a settings page that uses SettingsView.swift
I have made a ViewController and added a UISwitch, I have then used @IBOutlet
to link it to the SettingsView.swift
However I do not know how to get the UISwitch to change the let dns = "1.1.1.1,8.8.8.8"
in VPNUK1.swift
from SettingsView.swift
I would like, when the switch is toggled, have it changed to let dns = "185.136.234.36"
In settings view controller use a if / else ui switch to set UserDefaults.standard.set("1.1.1.1", forKey: "DNS")
In the vpn view controller: "dns": UserDefaults.standard.string(forKey: "DNS")!