I have the following code:
let file = "/path/to/en.lproj/Localizable.strings"
let dec = PropertyListDecoder()
var f: PropertyListSerialization.PropertyListFormat = .openStep
do {
//let data = strings.data(using: .utf8)!
let data = try Data(contentsOf: URL(fileURLWithPath: file))
let list = try dec.decode([String: String].self, from: data, format: &f)
print("foramt:", f.rawValue)
list.forEach { print($0.key, $0.value) }
} catch { print(error) }
It seems PropertyListDecoder can correctly decode .strings file format; detected format is openStep (value is 1). But I am note sure because I couldn't find any docs on PropertyListDecoder about .strings file.
Can anyone confirm this?