简体   繁体   English

Objective-C中的Builder模式

[英]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). 我是Objective-C的新手,特别是iOS,我不知道它是什么,但是如果实际使用这个设计模式(因为你需要嵌套类,静态方法等)。 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. 如果有一个等效的设计模式,我想学习它,或者如果它完全按原样使用,我想要一个例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM