Each answered a direct question: "Is there a limit?" However, I found this chain that really wants to understand " what is too much to store in UserDefaults?"
If you are looking for this answer, thread is useful here. The answers that I found useful were to go to the project file and see the size of the plist file:
5 objects almost nothing. You will be fine!
On my machine, I have about 28 megabytes of data in my default settings. This does not cause any problems.
From my general programming experience with arrays, I would suggest that performance starts to decay quickly when you fall in 1000, depending on the size of the element. Therefore, in the program I would not have a problem with storing several hundred elements. This says that I will probably start using the sqlite3 or coredata database sooner rather than later if you were you.
Important to remember:
The above mitigated my concern that a growing number of defaults (around 20-25 now) would cause problems. I already use CoreData, so I considered what to use, since the number of allowed user settings / settings is increasing. So, I'm going to stay with user defaults.
However , as other answers pointed out, the file will be read and written as a whole. So reading 20 key / string dictionaries and 5 key / boolean dictionaries just to extract a single line ... is not entirely ideal. However, if that doesn't hurt performance, and it saves you a ton of code, why not?
Dave G Jan 12 '17 at 2:19 on 2017-01-12 14:19
source share