Christopher Francisco
Christopher Francisco

Reputation: 16258

Builder pattern in Objective-C

I'm used to construct object using the builder pattern like the following:

MyObject myObject = new MyObject.Builder()
    .setProperty1(property1)
    .setProperty2(property2)
    .setProperty3(property3)
    .create();

I'm new to Objective-C specifically iOS, and I am wondering not exactly it, but if this design pattern is actually used (since you need nested classes, static methods, etc). If there is an equivalent design pattern, I'd like to learn it, or if it is used exactly as it is, I'd like an example.

Upvotes: 3

Views: 2645

Answers (1)

Jean-Baptiste Yunès
Jean-Baptiste Yunès

Reputation: 36391

I can suggest you to read the following article : https://annema.me/2014/04/04/the-builder-pattern-in-objective-c/

Upvotes: 2

Related Questions