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 meaning of 'atomic' keyword?

530


What are the steps you must follow to configure your computer and development device for iphone development?

381


Will iphone 6s get ios 14?

435


What are the application lifecycle in ios?

468


What is ios technology?

454






Explain me what is fast enumeration?

475


Flow of push notification?

497


what does @synthesize do?

510


Explain the difference between inheritance and category?

427


What is meaning of 'copy' keyword?

488


How to start a selector on a background thread.

455


What is iphone screen size?

489


What major changes released in ios7, ios8, ios9+?

443


Is xcode a framework?

484


Can I have relationship between entities in separate stores (in case of configurations)?

453