Submit Search
[Swift] Factory Method
0 likes
19 views
Bill Kim
Swift 소스 코드를 통한 Factory Method 디자인패턴에 관한 강의 자료입니다.
Education
Read more
1 of 11
Download now
Download to read offline
1
2
3
4
5
6
7
8
9
10
11
More Related Content
PDF
190311 factory
Hyeon-Woo Sa
PDF
[Swift] Proxy
Bill Kim
ODP
Design Pattern 3
Daniel Lim
PDF
[Swift] Abstract Factory
Bill Kim
PPTX
Builder, prototype, singleton pattern
YoonJong Choi
PDF
[Swift] Prototype
Bill Kim
PDF
[Swift] Builder
Bill Kim
PPTX
도메인 주도 설계 - 6장 도메인 객체의 생명주기
JangHyuk You
190311 factory
Hyeon-Woo Sa
[Swift] Proxy
Bill Kim
Design Pattern 3
Daniel Lim
[Swift] Abstract Factory
Bill Kim
Builder, prototype, singleton pattern
YoonJong Choi
[Swift] Prototype
Bill Kim
[Swift] Builder
Bill Kim
도메인 주도 설계 - 6장 도메인 객체의 생명주기
JangHyuk You
Similar to [Swift] Factory Method
(16)
PDF
HolubOnPatterns/chapter2_2
SeungHyun Hwang
PDF
Effective java
Haeil Yi
PDF
MEC++ 5
Gyeongwook Choi
PDF
[Swift] Decorator
Bill Kim
PPTX
Design patterns
Joshua Yoon
PDF
Spring Framework - Inversion of Control Container
Kyung Koo Yoon
PPTX
[스프링 스터디 2일차] AOP
AnselmKim
PPTX
Abstract factory pattern
minjin00
PDF
Javascript 객체생성패턴
KIM HEE JAE
DOCX
Kotlin 테스트 코드 결함 Intellij 플러그인 개발기.docx
ridex92
PDF
2014-15 Intermediate C++ Study #6
Chris Ohk
PPTX
Refelction의 개념과 RTTR 라이브러리
ssuser7c5a40
PPTX
디자인 패턴 적용
Sean Choi
PPTX
StarUML NS Guide - Design
태욱 양
PPTX
Mec chapter 5,6
문익 장
PPTX
Stonze study week1
Injae Lee
HolubOnPatterns/chapter2_2
SeungHyun Hwang
Effective java
Haeil Yi
MEC++ 5
Gyeongwook Choi
[Swift] Decorator
Bill Kim
Design patterns
Joshua Yoon
Spring Framework - Inversion of Control Container
Kyung Koo Yoon
[스프링 스터디 2일차] AOP
AnselmKim
Abstract factory pattern
minjin00
Javascript 객체생성패턴
KIM HEE JAE
Kotlin 테스트 코드 결함 Intellij 플러그인 개발기.docx
ridex92
2014-15 Intermediate C++ Study #6
Chris Ohk
Refelction의 개념과 RTTR 라이브러리
ssuser7c5a40
디자인 패턴 적용
Sean Choi
StarUML NS Guide - Design
태욱 양
Mec chapter 5,6
문익 장
Stonze study week1
Injae Lee
Ad
More from Bill Kim
(20)
PDF
[Algorithm] Sorting Comparison
Bill Kim
PDF
[Algorithm] Big O Notation
Bill Kim
PDF
[Algorithm] Shell Sort
Bill Kim
PDF
[Algorithm] Radix Sort
Bill Kim
PDF
[Algorithm] Quick Sort
Bill Kim
PDF
[Algorithm] Heap Sort
Bill Kim
PDF
[Algorithm] Counting Sort
Bill Kim
PDF
[Algorithm] Selection Sort
Bill Kim
PDF
[Algorithm] Merge Sort
Bill Kim
PDF
[Algorithm] Insertion Sort
Bill Kim
PDF
[Algorithm] Bubble Sort
Bill Kim
PDF
[Algorithm] Binary Search
Bill Kim
PDF
[Algorithm] Recursive(재귀)
Bill Kim
PDF
[Swift] Data Structure - AVL
Bill Kim
PDF
[Swift] Data Structure - Binary Search Tree
Bill Kim
PDF
[Swift] Data Structure - Graph(BFS)
Bill Kim
PDF
[Swift] Data Structure - Graph(DFS)
Bill Kim
PDF
[Swift] Data Structure - Binary Tree
Bill Kim
PDF
[Swift] Data Structure - Tree
Bill Kim
PDF
[Swift] Data Structure - Graph
Bill Kim
[Algorithm] Sorting Comparison
Bill Kim
[Algorithm] Big O Notation
Bill Kim
[Algorithm] Shell Sort
Bill Kim
[Algorithm] Radix Sort
Bill Kim
[Algorithm] Quick Sort
Bill Kim
[Algorithm] Heap Sort
Bill Kim
[Algorithm] Counting Sort
Bill Kim
[Algorithm] Selection Sort
Bill Kim
[Algorithm] Merge Sort
Bill Kim
[Algorithm] Insertion Sort
Bill Kim
[Algorithm] Bubble Sort
Bill Kim
[Algorithm] Binary Search
Bill Kim
[Algorithm] Recursive(재귀)
Bill Kim
[Swift] Data Structure - AVL
Bill Kim
[Swift] Data Structure - Binary Search Tree
Bill Kim
[Swift] Data Structure - Graph(BFS)
Bill Kim
[Swift] Data Structure - Graph(DFS)
Bill Kim
[Swift] Data Structure - Binary Tree
Bill Kim
[Swift] Data Structure - Tree
Bill Kim
[Swift] Data Structure - Graph
Bill Kim
Ad
[Swift] Factory Method
1.
SWIFT Factory Method Bill Kim(김정훈)
| ibillkim@gmail.com
2.
목차 •Factory Method •Structure •Implementation •References
3.
Factory Method Factory Mthod(팩토리
매소드) 디자인 패턴은 객체 생성을 위해 인터페이스는 정의하지만 어떤 클래스의 인스턴스를 생성할 지에 결정은 서브클래스가 정의하도록 해주는 디자인 패턴입니다. 팩토리 메서드는 직접 인스턴스를 생성하는 대신 생성을 위한 메서 드를 인터페이스로 제공합니다. 서브 클래스는 생성될 객체의 클래 스를 변경하기 위해서 메서드를 재정의 할 수 있습니다.
4.
Factory Method 팩토리 매소드
패턴을 위해서 필요한 객체 구성은 아래와 같습니다.
5.
Structure Creator : 추상
팩토리 메소드 정의 및 팩토리 메소드를 호출하여 Product를 생성하기 위한 객체 Product : 팩토리 메소드에 의해 성성되는 기본 인터페이스 객체 Concrete Creator : 팩토리 메소드를 구현하고 Concrete Product 인스턴스를 반환하는 객체 Concrete Product : Product를 구현하는 객체
6.
Implementation 구체적인 구현에 대해서
소스 코드를 통하여 살펴봅니다. // Creator protocol Creator { func factoryMethod() -> Product func someOperation() -> String } extension Creator { func someOperation() -> String { let product = factoryMethod() return product.operation() } } // Product protocol Product { func operation() -> String }
7.
Implementation // Concrete Creators class
ConcreteCreator1: Creator { public func factoryMethod() -> Product { return ConcreteProduct1() } } class ConcreteCreator2: Creator { public func factoryMethod() -> Product { return ConcreteProduct2() } } // Concrete Products class ConcreteProduct1: Product { func operation() -> String { print("ConcreteProduct1 operation") return "ConcreteProduct1 operation" } } class ConcreteProduct2: Product { func operation() -> String { print("ConcreteProduct2 operation") return "ConcreteProduct2 operation" } }
8.
Implementation func concreteClient(creator: Creator)
{ creator.someOperation() } concreteClient(creator: ConcreteCreator1()) // ConcreteProduct1 operation concreteClient(creator: ConcreteCreator2()) // ConcreteProduct2 operation
9.
References [1] 팩토리 메서드
패턴 : https://jerome.kr/entry/factory-method- pattern?category=1114713 [2] [Swift] 팩토리 메서드(Factory Method) 패턴 : https:// m.blog.naver.com/PostView.nhn? blogId=horajjan&logNo=220804516206&categoryNo=97&prox yReferer=&proxyReferer=https:%2F%2Fwww.google.com%2F [3] Design Pattern - Factory : https://ehdrjsdlzzzz.github.io/ 2019/04/03/Design-Pattern-Factory/ [4] Swift Solutions: Factory Method Pattern : https:// swiftcraft.io/swift-solutions-factory-method-pattern/ [5] Factory Method in Swift : https://refactoring.guru/design- patterns/factory-method/swift/example
10.
References [6] Swift factory
method design pattern : https:// theswiftdev.com/swift-factory-method-design-pattern/ [7] Factory Method in Swift : https://medium.com/jeremy-codes/ factory-method-in-swift-d5222dd6e61d [8] [Design Pattern] Factory method pattern : https:// medium.com/@eyegochild/design-pattern-factory-method- pattern-dc72f35e1076 [9] 디자인 패턴 : 추상 팩토리 vs 팩토리 메소드 : https://www.it- swarm.dev/ko/design-patterns/디자인-패턴-추상-팩토리-vs-팩토리- 메소드/970371311/ [10] Design Patterns in Swift #1 Factory Method and Singleton : https://www.appcoda.com/design-pattern-creational/
11.
Thank you!
Download