我正在尝试使用以下NumberFormatter
内容,但不知道如何在Text
视图中使用它?网上的一切都与TextView
.
static let numberFormat: NumberFormatter = {
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .none
numberFormatter.positivePrefix = "+"
numberFormatter.negativePrefix = "-"
return numberFormatter
}()
我尝试使用:但我收到错误Instance method 'appendInterpolation(_:formatter:)' requires that 'Int' inherit from 'NSObject'
Text("\(450, formatter: Self.numberFormat)")