Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 252
belab Avatar asked Oct 03 '16 15:10

belab


1 Answers

Try

Label.text = numberFormatter.string(from: NSNumber(value: value))
like image 170
Cruz Avatar answered Sep 28 '22 19:09

Cruz