What is factory methods ? What is the advantage of using it ?

Answer Posted / babu

Class factory methods are implemented by a class as a convenience for developers. These methods combine allocation and initialisation in a single step and return the created object.

NSDate:

Eg: + (id)dataWithBytes:(const void *)bytes length:(unsigned)length;

NSDictionary

Eg:+ (instancetype)dictionary;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When an app is said to be in active state?

446


What is block in ios swift?

490


How can you enable client certificate in ios 12? : IOS Architect

409


What is meaning of 'retain' keyword?

530


What is iphone os?

493






What is thread in ios?

473


What is the difference strong and weak reference?

422


What is difference between category and extension in ios?

394


What is push notification?

526


What is core data in ios swift?

437


What is block in ios?

457


How we can wait for some thread to finish before starting another?

418


What is spritekit and what is scenekit?

453


What is difference between weak and strong in ios?

421


When a nsfetchrequest fetches an entity object from store, does it fetch all of its data at once?

459