iOS class selection NSDictionary or Core Data -
i learning ios programming , wouldn't mind opinion or 2 on appropriate class use application, nsdictionary
or core data
. able create array of records set of attributes.
for example, name: joe citizen, age:38, sex: male, profession: zookeeper, city: sydney etc.
i able randomly select record 1 or more attribute. last night moving towards nsdictionary
solution, embed properties bit mapped word, convert string, , append strings string make key unique such k_stringbitpattern_uniquenumber
. random identifier generate random number, mask it, convert string etc, point realized getting cumbersome.
i new ios programming , trying consider speed, memory usage, elegance , reuse. getting seasoned opinions help.
i apologize in advance if use of terms not strictly correct (i.e. array of records). oh yes, records read-only, , hope able extend app later pull data website. helpful comments appreciated.
this question programmers.stackexchange.com.
my answer build simplest , easiest understand model possible , don't worry optimizations.
in case, recommend nsarray
of plain old objective-c objects. in object class, make attributes properties. use nsnumber
instead of nsinteger
or int
numbers. searches can done simple loop or -filteredarrayusingpredicate:
.
later on, if based on performance needs, switching core data should not painful. magicalrecord. needed simplification of complexities of core data.
i not recommend building own indexes nsdictionary. @ point, beginning write own database. other people have solved problem.
Comments
Post a Comment