Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. override func viewDidLoad()
  2. {
  3. super.viewDidLoad()
  4. timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selector(self.tick) , userInfo: nil, repeats: true)
  5. }
  6.  
  7. @objc func tick() {
  8. let formatter = DateFormatter()
  9. formatter.dateFormat = "dd/MM/yyyy HH:mm"
  10.  
  11. labelTimer.text = formatter.string(from: Date())
  12.  
  13. zaman()
  14. zaman1()
  15. }
  16.  
  17. @objc func zaman(){
  18.  
  19. if timertext.text == String? (labelTimer.text!) {
  20. zamanlayıcıfunc()
  21. }else{
  22. return
  23. }
  24. }
  25. @objc func zamanlayıcıfunc()
  26. {
  27.  
  28. if labelcheckbox.text == ("aç"){
  29. updateState()
  30.  
  31. }
  32. if labelcheckbox.text == ("kapat"){
  33. updateState1()
  34. }
  35.  
  36. }
  37.  
  38.  
  39. @objc func zaman1(){
  40.  
  41. if timertext2.text == String? (labelTimer.text!) {
  42. zamanlayıcıfunc1()
  43. }else{
  44. return
  45. }
  46. }
  47. @objc func zamanlayıcıfunc1()
  48. {
  49.  
  50. if labelcheckbox2.text == ("saatinde kapat"){
  51. updateState1()
  52.  
  53. }
  54. else{
  55. updateState()
  56. }
  57.  
  58. }
  59.  
  60. @objc func updateState(){
  61.  
  62.  
  63. let ref = Database.database().reference()
  64. ref.child("(chip1InfoString1!)/states/(self.ekle2.text!)").setValue(true)
  65. getData()
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement