diff options
Diffstat (limited to 'CCCB Display/ConfigController.swift')
| -rw-r--r-- | CCCB Display/ConfigController.swift | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/CCCB Display/ConfigController.swift b/CCCB Display/ConfigController.swift new file mode 100644 index 0000000..92b6e37 --- /dev/null +++ b/CCCB Display/ConfigController.swift | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // | ||
| 2 | // ConfigController.swift | ||
| 3 | // CCCB Display | ||
| 4 | // | ||
| 5 | // Created by Dirk Engling on 26.05.23. | ||
| 6 | // | ||
| 7 | |||
| 8 | import Foundation | ||
| 9 | import UIKit | ||
| 10 | |||
| 11 | |||
| 12 | class ConfigController: UIViewController { | ||
| 13 | |||
| 14 | @IBOutlet weak var display_address: UITextField! | ||
| 15 | |||
| 16 | override func viewWillAppear(_ animated: Bool) { | ||
| 17 | super.viewWillAppear(animated) | ||
| 18 | let defaults = UserDefaults.standard | ||
| 19 | if let ip = defaults.string(forKey: "Display_Address") { | ||
| 20 | display_address.text = ip | ||
| 21 | } else { | ||
| 22 | display_address.text = "172.23.42.29" | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | @IBAction func cancelPressed(_ sender: Any) { | ||
| 27 | self.dismiss(animated: true) | ||
| 28 | } | ||
| 29 | |||
| 30 | @IBAction func donePressed(_ sender: Any) { | ||
| 31 | self.dismiss(animated: true) | ||
| 32 | let defaults = UserDefaults.standard | ||
| 33 | defaults.set(display_address.text, forKey: "Display_Address") | ||
| 34 | } | ||
| 35 | } | ||
