Group Group Group Group Group Group Group Group Group

Programming in Swift: Functions and Types · forEach & map | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5429279-programming-in-swift-functions-and-types/lessons/14

The following code giving error:
let priceLabels = salePrices.map { (price) -> String in
String(format: “%.2f”, price)
}

The error is:
error: argument type ‘()’ does not conform to expected type 'CVarArg’
String(format: “%.2f”, price)