0

I'm trying to add thousands separators on the numbers exporting out of two UILabels on my code. I've already searched for it on here but none works for my project. here's the part about calculation in my code so far:

import UIKit

class ViewController: UIViewController {
    @IBOutlet weak var userCount: UITextField!
    @IBOutlet weak var resultLabel: UILabel!
    @IBOutlet weak var projectAmount: UITextField!
    @IBOutlet weak var totalLabel: UILabel!

    @IBAction func polculateButton(_ sender: Any) {
        let usersCount = Double(self.userCount.text ?? "") ?? 0
        let commissionPercentage = 0.26

        let projectsAmount = Double(self.projectAmount.text ?? "") ?? 0

        let totalsLabel = (usersCount * projectsAmount)
        self.totalLabel.text = "\(totalsLabel)"

        let resultsLabel = (usersCount * commissionPercentage * projectsAmount)
        self.resultLabel.text = "\(resultsLabel)"
    }
} 

What code should I add here?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Shahin
  • 71
  • 2
  • 11

0 Answers0