Argument labels '(_:)' do not match available overloads


Hi all! Hope you’re all well.

I’ve been experimenting around with code but I’ve noticed that code that used to work in Xcode 7 is now no longer working in Xcode 8. I’m getting the following error:

Argument labels ‘(_:)’ do not match available overloads.

I am getting that error from this piece of code:

let someNumbers = [1, 41, 30, 77]
let words = { NumberFormatter.localizedString(from: NSNumber($0), number: .spellOutStyle) }

From this code, I’m trying to spell out the numbers that are in the array for example “1” ought to become “one.”

I’ll appreciate it much if someone here can help. Many thanks in advance.


Hi guys! Just an update. I’ve managed to make it work. It turns out it didn’t like the “NSNumber($0)” part. The from argument needs to be taking NSNumber objects and not converting them there. Below is my solution. If anyone here has a better solution or explanation, I would love to hear it. Many thanks.

var someNumber = NSNumber(value: 1)
var numberOfCats: [NSNumber] = [ ]
let words = { NumberFormatter.localizedString(from: $0, number: .spellOut) }