I have a calculation that calculate square meters from millimeters and for this to show corect I would like to remove all numbers after the 2 first digits.
This is what I have tried so far.
let spha = sizeh.wshight()
let spwa = sizew.wswidth()
let areas1 = areaModel(pwa:spwa, pha:spha)
let formatter5 = NSNumberFormatter ()
formatter5.maximum = 2
let scarea = formatter5.stringFromNumber(areas1.sarea())!
screenAreaLabel?.text = "\(scarea)sqm"
You are multiplicating a value in millimeter by anothe value in milliters, therefore the result is in square millimeters.
To convert square millimeters to square meters, just divide the result by
You could also set
1.0 / 1_000_000.