Store a large list of static strings (Swift)
1 answer
Usual Objective-C experience is used. You can actually use any of the methods you describe. Some comments:
- XML: seems like overkill. You will need a parser, etc.
- Exception: Apple property lists (which is also XML format). You can read the entire list with one layer
- Plain text: contains multiple lines of code to read it, so it might be viable. It would be especially easy to make the list in the first place (e.g. using excel or a text editor).
- Binary: not recommended for strings.
- Core Data: Stores rows in a neat SQLite database, but would probably be overkill as well.
eg. for plist:
let wordList = NSArray(contentsOfFile: path)
+2
source to share