Open Daniel1of1 opened 8 years ago
Thanks for the comment that's really useful. This will go in.
For now, for your particular question, the library works on a single string. So if you want to read from a file, you would do something along the lines of:
let inputString = try! String(contentsOfFile: "path/to/file")
let csv = CSwiftV(String: inputString)
Then on csv
you can ask for .rows
or .keyedRows
which will give you either an 'array' of rows (and a row is an array of strings) or an array of 'keyedRows' which are dictionaries of type [String:String] which have the header of the column as their key.
One thing that could be added to the doc is - how do I include this in my project? I tried building it and dragging the .framework over to another project's Frameworks, but it didn't work. I eventually got it to work with CocoaPods, though I had to manually update the out-of-date code it downloaded to replace it with Swift 3-compatible code
Nice @thully thanks, check out my comment for the other issue by the way incase it helps in any way. https://github.com/Daniel1of1/CSwiftV/issues/29#issuecomment-251667487
Hey, thanks for this. Can you add something to the doc like: what if I need to read from a csv file ? should I read it line by line using swift string methods then call that string using CSwiftV(String: inputString) ? or should I use something else ?
Sorry for this question but I'm new to programming and have no idea how to use your framework to read from a csv file