Generate XML files with swift
You could use XMLDocument to write XML. For example:
import Foundationlet root = XMLElement(name: "root")let xml = XMLDocument(rootElement: root)root.addChild(XMLElement(name: "foo", stringValue:"bar"))print(xml.xmlString)
I made this new simple and lightweight XML parser for iOS in Swift - AEXML
You can use it to read XML data like this:
let someValue = xmlDocument["element"]["child"]["anotherChild"].value
or you can use it to build XML string like this:
let document = AEXMLDocument()let element = document.addChild("element")element.addChild("child")document.xmlString // returns XML string of the entire document structure
NSXMLDocument works for OSX, but does not exist on iOS, so this will help in that case.