Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidLoad()
- {
- super.viewDidLoad()
- timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selector(self.tick) , userInfo: nil, repeats: true)
- }
- @objc func tick() {
- let formatter = DateFormatter()
- formatter.dateFormat = "dd/MM/yyyy HH:mm"
- labelTimer.text = formatter.string(from: Date())
- zaman()
- zaman1()
- }
- @objc func zaman(){
- if timertext.text == String? (labelTimer.text!) {
- zamanlayıcıfunc()
- }else{
- return
- }
- }
- @objc func zamanlayıcıfunc()
- {
- if labelcheckbox.text == ("aç"){
- updateState()
- }
- if labelcheckbox.text == ("kapat"){
- updateState1()
- }
- }
- @objc func zaman1(){
- if timertext2.text == String? (labelTimer.text!) {
- zamanlayıcıfunc1()
- }else{
- return
- }
- }
- @objc func zamanlayıcıfunc1()
- {
- if labelcheckbox2.text == ("saatinde kapat"){
- updateState1()
- }
- else{
- updateState()
- }
- }
- @objc func updateState(){
- let ref = Database.database().reference()
- ref.child("(chip1InfoString1!)/states/(self.ekle2.text!)").setValue(true)
- getData()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement