I'm trying to add thousands separators on the numbers exporting out of two UILabel
s 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?