How to change font color/properties with a countdown timer?

I am developing a quiz app and the user is awarded 15 seconds to answer the question before the question is considered wrong. The text of the countdown timer is set as white as it is the actually just a label. Is there a way in code to change it to where when the countdown timer hits 5 seconds the font turns to red to alert the user with a sign that time is running out?

Here’s my relevant code:

import UIKit

 class ViewController: UIViewController {


func updateCounter() {




    counter -= 1
    questionTimer.text = String(counter)

    if counter == 0 {


        timer.invalidate()
        wrongSeg()
        }


}

  //variables
var counter = 15

var timer = Timer()

@IBOutlet weak var questionTimer: UILabel!

You can use

 var counter: Int = 15 {
    didSet {
        print("The value of counter changed from /(oldValue) to /(counter)")
        if (counter == 5){
        //Change the question timer color.
        }
    }
}

you can use this code :

func updateCounter() {
    counter -= 1
    if counter <= 5{
        questionTimer.textColor = .red;
    }
    questionTimer.text = String(counter)

    if counter == 0 {


        timer.invalidate()
        wrongSeg()
        }


}