Need to use user defaults to save high score in (swift3)

Right now I have two labels. I would like “winningLabel” to print the games current score and “hhighscore” to save the games highest score. Right now I have a pitcure of what the code will present pic. The smaller of the two labels is hhighscore. I would just like hhighscore to save the games highest score. The score is defined by totalTime. Picture

    import UIKit
      class winViewController: UIViewController {
      @IBOutlet var score2: UILabel!
    @IBOutlet var winningLabel: UILabel!
   var highScore : Double = 0
    var score : Double = 0

@IBOutlet var hhighscore: UILabel!
public var LebelText: String?
public var LebelText2: String?
    public var LebelText3: String?
    public var LebelText4: String?

 override func viewDidLoad() {

        func timeCalculation(){

    guard let unwrapedText = self.LebelText2 else {

    guard let unwrapedText2 = self.LebelText else {
    guard let unwrapedText3 = self.LebelText3 else {
    guard let unwrapedText4 = self.LebelText4 else {

    if let myInt = Double(unwrapedText),  let myInt2 = Double(unwrapedText2), let myInt3 = Double(unwrapedText3), let myInt4 = Double(unwrapedText4)
        let  totalTime = myInt + myInt2 + myInt3 + myInt4
        self.winningLabel.text = "You won"+"\n"+"Reaction time :" + String(totalTime) + " Seconds"

        hhighscore.text = String(totalTime)


OK, so what’s the question?

If you just need to know about user defaults, it is now UserDefaults in Swift 3 but remains very easy to use. You get the default object with UserDefaults.standard and you will probably use set(Float, forKey: String) followed by synchronize to write the high score value, then float(forKey: String) to read it again.

but no longer any requirement to synchronize

Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) or if you want to update the user defaults to what is on disk even though you have not made any changes.

Sure, you can rely on the periodic synchronization.

Got issue resolved thank you for your support.