Storing thousands of entries in a property list is generally not a great idea. It’ll work, but you can only access a property list by loading the whole thing into memory, which is not a good option on memory-constrained platforms like the watch.
Storing this is SQLite probably makes sense, although it depends on how you access the data. For example, imagine a
Word
table like this:
Row English German
--- ------- ------
1 butcher Metzger
2 baker Bäcker
3 candlestick maker Kerzenmacher
… and so on …
You might want to create indexes over this table so that you can search the English column for “maker” and quickly find row 3, or search the German column for “back” and quicker find row 3. SQLite can handle this sort of thing, but it’s definitely a more advanced use case.
That data is static, but I will also want to store other user data that maps to these words such as whether the user has already seen this word.
When dealing with large databases, it’s important to separate the read-only stuff that’s part of your app (or downloadable content, but downloadable by all users) and the read/write stuff that’s specific to your current user. Without this, you might end up trying to back up your large read-only data set, which will run afoul of the iOS Data Storage Guidelines.
In this case, I’d recommend a second database with a
HasSeen
table that records the ID of every word that this user has seen.
I haven't been able to find documentation on how to create an SQLite database within a Watch app.
There’s nothing special about a watchOS here. The techniques you use for this on iOS will work just fine on watchOS.
The only wrinkle that watchOS brings to the table is the need for syncing. If you want the user’s progress on their watch to be reflected on their phone, and vice versa, you’ll need a syncing strategy. Then again, the same could be said of syncing between the users phone and iPad.
This, btw, is another good reason to separate out this read/write data.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"