ios - Is it ok to read a value stored in NSUserDefaults in multiple views -


is ok read value stored in nsuserdefaults multiple views or read once , use method pass data different part of app?

in other words want know if i’m doing right, i’m doing in app i’m working on saving couple of nsintegers , nsstrings (only 2 or 3 of each) in nsuserdefaults , i’m reading values in different parts of app (different views) wondering if common practice or should doing different like, read value somewhere in app , try use different method pass data other views. want learn best programming practices, that’s all.

what common practice when using nsuserdefaults values in multiple parts of app?

fyi, i’m familiar multiple ways pass data between view controllers such as, delegation, prepareforsegue etc.

thanks lot.

it ok read , write values nsuserdefault in multiple places, better practice have global mechanism (like singleton pattern) read , write userdefaults. way you'll guaranteed have synchronized values. need create new class , add few class methods read , write values nsuserdefaults.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -