Read file

file io swift 2.2

        let fileLocation = NSBundle.mainBundle().pathForResource("2311393", ofType: "xml")!
        let text : String
        do
        {
            text = try String(contentsOfFile: fileLocation)
        }
        catch
        {
            text = ""
        }

Tags: