what is singleton class? Why the whole application creates a single instance?

Answer Posted / babu

A singleton class is a special kind of class where only one instance of the class exists for the entire application. (In the case of an iPhone app, the one instance is shared across the entire app.) Some examples in UIKit are [UIApplication sharedApplication] (which returns the sole instance of the application itself), and [NSFileManager defaultManager] (which returns the file manager instance). Singletons can be an easy way to share data and common methods across your entire app.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is retain counts?

580


When was ios invented?

670


What are the different store migration options? When are they used?

633


How to parse xml? Explain

677


How to pass parameter to selector function in swift? : IOS Architect

901


What is difference between shallow copy and deep copy in ios ? : IOS Architect

696


Can python apps run on ios?

636


How do you decide when to use infinite scroll or pagination in ios? : IOS Architect

698


Why core data is faster than sqlite?

710


Who calls the main function of app during the app launch cycle in ios?

649


How do you usually persist data on ios? : IOS Architect

599


How to delete images in ios?

645


Explain what is the stack of autorelease pools. How autorelease pool work under the hood?

1238


What is nsmanagedobjectcontext?

655


What is reference count in ios?

675