0 Replies
      Latest reply on Sep 27, 2019 6:46 AM by advancecoder
      advancecoder Level 1 Level 1 (0 points)

        The Timer on WatchKit doesn't execute the lblTimer.setText("(currentTime)") properly when it is there in the function called when the timer fires. What should I do to fix this problem? The label is just static and should be updated very often. Does the watchOS simulator have a bug?

        Also, I tried the Timer from watckKit and that didn't work either.

        Here's the sample code where the lblTimer.setText doesn't execute on the screen:


        @objc func fire()
          if (countDown <= 0.0) {
          speechSynthesizer?.speak(AVSpeechUtterance(string: "You ran out of time! Next question!"))
          countDown = 30.0
          } else {
          countDown -= 0.01
          let numberOfPlaces = 2.0
          let multiplier: Float = Float(pow(10.0, numberOfPlaces))
          let num: Float = countDown
          let rounded = round(num * multiplier) / multiplier
          lblTimer.setText("Time: \(rounded)")