Swift 3 (Xcode 8 测试版 6) localizedStringWithFormat

Swift 3 (Xcode 8 beta 6) localizedStringWithFormat

有没有更好的方法来获取本地化格式并将字符串替换为 Xcode 8 Swift 3?是否需要使用NSString,在NSString和String之间来回转换?

let localizedDue = NSString.localizedStringWithFormat(NSLocalizedString("Due: %@", comment: "due date label with date") as NSString, formattedDate) as String

我可能遗漏了一些东西,但是在 Swift 3 中,String 有一个类型方法 localizedStringWithFormat,你可以这样写:

let localizedDue = String.localizedStringWithFormat(NSLocalizedString("Due: %@", comment: "due date label with date"), formattedDate)

如果这不是您想要的,请更新您的 post。