views:

59

answers:

3

I have a UITableView with some login form and I manually wrote the configuration values of the UITextFields in this NSArray as NSDictionaries. It is bothering because it's data in the code. I don't want data in my code! And I think that nobody wants that.

Have you ever been in this situation? How would you dispose properly of this data?

I'm going to move it to a plist but I'm not sure is the right solution.

+1  A: 

A plist is ideal for storing this kind of data. NSArray even includes support for loading straight out of the file.

Chuck
Yeah but it has a few shortcomings, like you can't use constants just numbers... it's confusing!
gurghet
A: 

Another options is to store the information in an SQLite database, which you can then access using FMDB (http://github.com/ccgus/fmdb).

Abhi
A: 

We do things like this using JSON. The very nice SBJson library does all the heavy lifting. You can load the JSON from file directly into a dictionary. Support for strings, numbers, arrays etc... A bit more handy than SQLite, and more flexible than plists.

Daniel Blezek
That sounds nice, I already use JSON for server communication. But where to store this information?
gurghet