From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Convert CSV files

Convert CSV files

- [Instructor] One old but still often used method for text based data sending is CSV or comma-separated values. Swift has some methods that make handling CSVs rather simple which have plenty of other uses to split up strings into usable parts. If you download the exercise file, you'll find I have triple-quote literal and I'll find that right here if I go to Playground, and there's my triple-quote literal. There's a lot of stuff around here, so I'm close a bunch of this stuff up so we can see it nicely. And so there's our data and I set it up as a triple-quote literal so I could actually put some new lines in here. So we've got new lines and we've got data that is comma-separated here, and if you want to read more about the data, I have a little comment on top about it. And then underneath that, I set up a class MenuEntry to represent each type of donut as a property, and then outside of this class, I set up an array of menu entries. And then below that, I've got a way of printing it.…

Contents