guide/Guibe/SecretsViewController.swift
2019-07-20 20:47:20 +01:00

77 lines
2.6 KiB
Swift

//
// SecretsViewController.swift
// Guibe
//
// Created by Max Hunt on 16/06/2019.
// Copyright © 2019 8. All rights reserved.
//
import UIKit
class SecretsViewController: UIViewController {
let defaults = UserDefaults.standard
// @IBOutlet weak var menuView: UIView!
@IBOutlet weak var resetCfg: UIButton!
@IBOutlet weak var easterEgg: UIButton!
@IBOutlet weak var backBtn: UIButton!
@IBOutlet weak var DLblSwitch: UISwitch!
@IBOutlet weak var label1: UILabel!
@IBOutlet weak var label0: UILabel!
@IBOutlet var vc: UIView!
@IBAction func resetBtnPressed(_ sender: Any) {
defaults.set(0, forKey: "setupDone")
self.resetCfg.alpha = 0.0
}
@IBAction func valueToggled(_ sender: Any) {
if self.DLblSwitch.isOn == true {
defaults.set(2, forKey: "debug")
}
else {
defaults.set(1, forKey: "debug")
}
}
@IBAction func easterBtnPressed(_ sender: Any) {
UIView.animate(withDuration: 0.2, animations: {self.view.backgroundColor = .green})
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .red})}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.8) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .blue})}
DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .yellow})}
DispatchQueue.main.asyncAfter(deadline: .now() + 1.6) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .cyan})}
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .magenta})}
DispatchQueue.main.asyncAfter(deadline: .now() + 2.4) {UIView.animate(withDuration: 0.3, animations:{self.view.backgroundColor = .white})}
}
@IBAction func backBtnPressed(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
label1.textColor = UIColor.secondaryLabel
label0.textColor = UIColor.secondaryLabel
vc.backgroundColor = UIColor.systemBackground
let DBVal = defaults.integer(forKey: "debug")
if DBVal == 2 {
DLblSwitch.isOn = true
}
else {
defaults.set(1, forKey: "debug")
DLblSwitch.isOn = false
}
}
// defaults.set(0, forKey: "setupDone")
}