基本上我有一个包含以下代码的类:
class Example
{
let locale = Locale.current
public init (locale: Locale = Locale.current)
{
self.locale = locale
}
public func GetFormatedString(date: Date,
formattingString: String,
locale: Locale = self.locale) -> String
{
let dateFormat = DateFormatter()
dateFormat.dateFormat = formattingString
return dateFormat.string(from: date)
}
}
如何将区域设置属性引用为 GetFormatedString()的最后一个参数的默认值。
提前谢谢!