belab belab - 1 year ago 195
iOS Question

issue with NSNumber in swift 3

I have converted my project to swift 3, and I have a problem with NSNumber that I cannot deal with.
Here's my number formatter declaration

let numberFormatter: NumberFormatter = {
let nf = NumberFormatter()
nf.numberStyle = .decimal
nf.minimumFractionDigits = 0
nf.maximumFractionDigits = 1
return nf

and here's place with error.
Value is a double, sure that other things ale fine.

Label.text = numberFormatter.string(from: NSNumber(value))

Message from debugger:

Arguments labels '(_:)' do not match any available overloads

Before conversion everything worked. Please help, I cannot find

Answer Source


Label.text = numberFormatter.string(from: NSNumber(value: value))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download