What does `standardUserDefaults` on` NSUserDefaults` do?

I have a question related to NSUserDefaults standardUserDefaults. What exactly does the method standardUserDefaultsdo? Is this object initialization?

+3
source share
1 answer

Yes or no. NSUserDefaultsis a singleton, so there is always only one instance of a class, and standardUserDefaults- a method for obtaining this single instance.

If the instance NSUserDefaultsdoes not exist yet, it will be alloc'ed and init' ed and then returned, otherwise this already present instance is returned.

+4
source

Source: https://habr.com/ru/post/1763566/


All Articles