Closed MehmetBal closed 5 years ago
Glad you were able to find something and that you dropped the link to the approach here! I wonder if this might be a way to handle #197 as well given that Swift already has some pretty good Codable/JSON (via Encodable and Decodable) support.
@drmohundro I think so. Isn't the below what #197 is looking for:
let jsonEncoder = JSONEncoder()
jsonEncoder.outputFormatting = .prettyPrinted
do {
let data = try jsonEncoder.encode(data)
try data.write(to: outputJSONURL)
print("wrote to output url successfully")
NSWorkspace.shared.open(outputJSONURL)
} catch {
print("error occured ---> \(error)")
}
Hi,
Thanks for this library. I am looking for a way to convert the result object of XMLIndexer to a Swift dictionary. Typed Swift dictionaries conforms to Codable protocol which makes creating Plist easy (Ex: PropertyListEncoder().encode(dict).write(to: fileURL)). Currently, I have XMLIndexerDeserializable object that I parse to then I convert that to dictionary manually and call the PropertylistEncoder.
Does SWXMLHash provide such functionality? Otherwise, what would you suggest doing?
Thanks