SlideShare a Scribd company logo
SWIFT
Protocol (2/2)
Bill Kim(김정훈) | ibillkim@gmail.com
목차
•Delegation
•Adding Protocols Conformance with an Extension
•Collections of Protocol Types
•Protocol Inheritance
•Class-Only Protocols
•Protocol Composition
•Optional Protocol Requirements
•Protocol ExtensionsChecking for Protocol Conformance
•References
Delegation
위임(Delegation)은 클래스 혹은 구조체 인스턴스에 특정 행위에 대한 책임을 넘길 수 있게 해
주는 디자인 패턴 중 하나입니다.
class Dice {
}
protocol DiceGame {
var dice: Dice { get }
func play()
}
// DiceGameDelegate에 선언해서 실제 DiceGame의 행위와 관련된 구현을
// DiceGameDelegate를 따르는 인스턴스에 위임합니다.
protocol DiceGameDelegate: AnyObject {
func gameDidStart(_ game: DiceGame)
func game(_ game: DiceGame, didStartNewTurnWithDiceRoll diceRoll: Int)
func gameDidEnd(_ game: DiceGame)
}
class SnakesAndLadders: DiceGame {
var dice: Dice = Dice()
weak var delegate: DiceGameDelegate?
func play() {
delegate?.gameDidStart(self)
}
func end() {
delegate?.gameDidEnd(self)
}
}
Delegation
class DiceGameTracker: DiceGameDelegate {
var numberOfTurns = 0
func gameDidStart(_ game: DiceGame) {
}
func game(_ game: DiceGame, didStartNewTurnWithDiceRoll
diceRoll: Int) {
}
func gameDidEnd(_ game: DiceGame) {
}
}
let tracker = DiceGameTracker()
let game = SnakesAndLadders()
game.delegate = tracker
game.play()
Adding Protocols Conformance with an Extension
이미 존재하는 타입에 새 프로토콜을 따르게 하기 위해 익스텐션을 사용할 수
있습니다.
원래 값에 접근 권한이 없어도 익스텐션을 사용해 기능을 확장할 수 있습니다.
class Dice {
let sides: Int
init(sides: Int) {
self.sides = sides
}
}
protocol TextRepresentable {
var textualDescription: String { get }
}
extension Dice: TextRepresentable {
var textualDescription: String {
return "A (sides)-sided dice"
}
}
let d12 = Dice(sides: 12)
print(d12.textualDescription) // Prints "A 12-sided dice"
Adding Protocols Conformance with an Extension
만약 어떤 프로토콜을 충족에 필요한 모든 조건을 만족하지만 아직
그 프로토콜을 따른다는 선언을 하지 않았다면 그 선언을 빈 익스텐
션으로 선언할 수 있습니다.
protocol TextRepresentable {
var textualDescription: String { get }
}
struct Hamster {
var name: String
var textualDescription: String {
return "A hamster named (name)"
}
}
// Hamster 인스턴스인 simonTheHamster는 이제 TextRepresentable 타입으로 사용할 수 있습니다.
extension Hamster: TextRepresentable {}
let simonTheHamster = Hamster(name: "Simon")
let somethingTextRepresentable: TextRepresentable = simonTheHamster
print(somethingTextRepresentable.textualDescription) // A hamster named Simon
Collections of Protocol Types
프로토콜을 Array, Dictionary등 Collection 타입에 넣기위한 타
입으로 사용할 수 있습니다.
let d12 = Dice(sides: 12)
let simonTheHamster = Hamster(name: "Simon")
let things: [TextRepresentable] = [d12, simonTheHamster]
for thing in things {
print(thing.textualDescription)
// A 12-sided dice
// A hamster named Simon
}
Protocol Inheritance
클래스 상속같이 프로토콜도 상속할 수 있습니다. 여러 프로토콜을
상속받는 경우 콤마(,)로 구분합니다.
protocol InheritingProtocol : SomeProtocol, AnotherProtocol {
// protocol definition goes here
}
protocol PrettyTextRepresentable : TextRepresentable {
var prettyTextualDescription: String { get }
}
Class-Only Protocols
구조체, 열거형에서 사용하지 않고 클래스 타입에만 사용가능한 프
로토콜을 선언하기 위해서는 프로토콜에 AnyObject를 추가합니
다.
protocol SomeClassOnlyProtocol: AnyObject, SomeInheritedProtocol {
// class-only protocol definition goes here
}
Protocol Composition
동시에 여러 프로토콜을 따르는 타입을 선언할 수 있습니다.
protocol Named {
var name: String { get }
}
protocol Aged {
var age: Int { get }
}
struct Person: Named, Aged {
var name: String
var age: Int
}
func wishHappyBirthday(to celebrator: Named & Aged) {
print("Happy birthday, (celebrator.name), you're (celebrator.age)!")
}
let birthdayPerson = Person(name: "Malcolm", age: 21)
wishHappyBirthday(to: birthdayPerson) // Happy birthday, Malcolm, you're 21!
Optional Protocol Requirements
프로토콜을 선언하면서 필수 구현이 아닌 선택적 구현 조건을 정의
할 수 있습니다.
이 프로토콜의 정의를 위해서 @objc 키워드를 프로토콜 앞에 붙이
고, 개별 함수 혹은 프로퍼티에는 @objc와 optional 키워드를 붙
입니다.
@objc 프로토콜은 클래스 타입에서만 채용될 수 있고 구조체나 열
거형에서는 사용할 수 없습니다.
@objc protocol CounterDataSource {
@objc optional func increment(forCount count: Int) -> Int
@objc optional var fixedIncrement: Int { get }
}
Protocol Extensions
익스텐션을 이용해 프로토콜을 확장할 수 있습니다.
protocol RandomNumberGenerator {
func random() -> Double
}
extension RandomNumberGenerator {
func randomBool() -> Bool {
return random() > 0.5
}
}
class LinearCongruentialGenerator: RandomNumberGenerator {
var lastRandom = 42.0
let m = 139968.0
let a = 3877.0
let c = 29573.0
func random() -> Double {
lastRandom = ((lastRandom * a + c).truncatingRemainder(dividingBy:m))
return lastRandom / m
}
}
let generator = LinearCongruentialGenerator()
print("Here's a random number: (generator.random())")
// Prints "Here's a random number: 0.3746499199817101”
print("And here's a random Boolean: (generator.randomBool())")
// Prints "And here's a random Boolean: true"
Protocol Extensions
프로토콜 익스텐션이 특정 조건에서만 적용되도록 선언할 수 있습니
다. 이 선언에는 where 절을 사용합니다.
다음은 Collection 엘리먼트가 Equatable인 경우에만 적용되는
allEqual()메소드를 구현한 예입니다.
extension Collection where Element: Equatable {
func allEqual() -> Bool {
for element in self {
if element != self.first {
return false
}
}
return true
}
}
let equalNumbers = [100, 100, 100, 100, 100]
let differentNumbers = [100, 100, 200, 100, 200]
print(equalNumbers.allEqual()) // true
print(differentNumbers.allEqual()) // false
References
[1] [Swift]Protocols 정리 : http://minsone.github.io/mac/
ios/swift-protocols-summary
[2] Protocols : https://docs.swift.org/swift-book/
LanguageGuide/Protocols.html
[3] Swift ) Protocols (4) : https://zeddios.tistory.com/347
[4] Swift Protocol 적재적소에 사용하기 : https://
academy.realm.io/kr/posts/understanding-swift-
protocol/
[5] Swift 4.2 Protocol 공식 문서 정리 : https://
medium.com/@kimtaesoo188/swift-4-2-protocol-공식-문서-
정리-f3a97c6f8cc2
References
[6] 프로토콜 (Protocols) : https://jusung.gitbook.io/the-
swift-language-guide/language-guide/21-protocols
[7] 오늘의 Swift 상식 (Protocol) : https://medium.com/
@jgj455/오늘의-swift-상식-protocol-f18c82571dad
[8] [Swift] Protocol [01] : https://baked-
corn.tistory.com/24
[9] [Swift] Protocol [02] : https://baked-
corn.tistory.com/26
[10] Swift – 프로토콜 지향 프로그래밍 : https://
blog.yagom.net/531/
Thank you!

More Related Content

What's hot (20)

PDF
일단 시작하는 코틀린
Park JoongSoo
 
PPTX
Javascript 실행 가능한 코드(Executable Code)와 실행 콘텍스트(Execution Context), Lexical En...
Young-Beom Rhee
 
PDF
7가지 동시성 모델 4장
HyeonSeok Choi
 
PDF
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
Yongha Yoo
 
PDF
함수적 사고 2장
HyeonSeok Choi
 
PPTX
프론트엔드스터디 E05 js closure oop
Young-Beom Rhee
 
PPTX
Startup JavaScript 8 - NPM, Express.JS
Circulus
 
PDF
C++ Concurrency in Action 9-2 Interrupting threads
Seok-joon Yun
 
PPTX
골때리는 자바스크립트 발표자료
욱진 양
 
PDF
프로그래밍 대회: C++11 이야기
Jongwook Choi
 
PDF
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
NAVER D2
 
PPTX
7가지 동시성 모델 - 3장. 함수형 프로그래밍
Hyunsoo Jung
 
PDF
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
혜웅 박
 
PDF
Javascript개발자의 눈으로 python 들여다보기
지수 윤
 
PDF
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
Code Engn
 
PDF
[Algorithm] Recursive(재귀)
Bill Kim
 
PDF
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
Code Engn
 
PPTX
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
Jaeseung Ha
 
PDF
GopherCon Korea 2015 - Python 개발자를 위한 Go (이경찬)
Kyoungchan Lee
 
PDF
스위프트 성능 이해하기
Yongha Yoo
 
일단 시작하는 코틀린
Park JoongSoo
 
Javascript 실행 가능한 코드(Executable Code)와 실행 콘텍스트(Execution Context), Lexical En...
Young-Beom Rhee
 
7가지 동시성 모델 4장
HyeonSeok Choi
 
스위프트, 코틀린과 모던언어의 특징 (Swift, Kotlin and Modern Languages)
Yongha Yoo
 
함수적 사고 2장
HyeonSeok Choi
 
프론트엔드스터디 E05 js closure oop
Young-Beom Rhee
 
Startup JavaScript 8 - NPM, Express.JS
Circulus
 
C++ Concurrency in Action 9-2 Interrupting threads
Seok-joon Yun
 
골때리는 자바스크립트 발표자료
욱진 양
 
프로그래밍 대회: C++11 이야기
Jongwook Choi
 
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
NAVER D2
 
7가지 동시성 모델 - 3장. 함수형 프로그래밍
Hyunsoo Jung
 
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
혜웅 박
 
Javascript개발자의 눈으로 python 들여다보기
지수 윤
 
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
Code Engn
 
[Algorithm] Recursive(재귀)
Bill Kim
 
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
Code Engn
 
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
Jaeseung Ha
 
GopherCon Korea 2015 - Python 개발자를 위한 Go (이경찬)
Kyoungchan Lee
 
스위프트 성능 이해하기
Yongha Yoo
 

Similar to [Swift] Protocol (2/2) (20)

PDF
[Swift] Protocol (1/2)
Bill Kim
 
PPT
Swift protocols
wileychoi
 
PDF
[Swift] Extensions
Bill Kim
 
PDF
Swift3 generic
Eunjoo Im
 
PDF
[Swift] Generics
Bill Kim
 
PDF
[Swift] Command
Bill Kim
 
PDF
객체지향 설계
준영 조
 
PPTX
Swift 0x17 generics
Hyun Jin Moon
 
PDF
Protocol Oriented Programming in Swift
SeongGyu Jo
 
PDF
[1B1]스위프트프로그래밍언어
NAVER D2
 
PDF
[SwiftStudy 2016] 2장. Swift 타입 파트 1
Keunhyun Oh
 
PDF
Swift5 vs objective c
Bill Kim
 
PDF
10 swift 열거형구조체클래스
Changwon National University
 
PDF
Swift3 subscript inheritance initialization
Eunjoo Im
 
PPTX
Swift3 : class and struct(+property+method)
승욱 정
 
PDF
[Swift] Prototype
Bill Kim
 
PPTX
17 swift 프로토콜
Changwon National University
 
PDF
I os 2
Sanghoon Han
 
PDF
Swift 3 Programming for iOS : class and structure
Kwang Woo NAM
 
PDF
Swift3 typecasting nested_type
Eunjoo Im
 
[Swift] Protocol (1/2)
Bill Kim
 
Swift protocols
wileychoi
 
[Swift] Extensions
Bill Kim
 
Swift3 generic
Eunjoo Im
 
[Swift] Generics
Bill Kim
 
[Swift] Command
Bill Kim
 
객체지향 설계
준영 조
 
Swift 0x17 generics
Hyun Jin Moon
 
Protocol Oriented Programming in Swift
SeongGyu Jo
 
[1B1]스위프트프로그래밍언어
NAVER D2
 
[SwiftStudy 2016] 2장. Swift 타입 파트 1
Keunhyun Oh
 
Swift5 vs objective c
Bill Kim
 
10 swift 열거형구조체클래스
Changwon National University
 
Swift3 subscript inheritance initialization
Eunjoo Im
 
Swift3 : class and struct(+property+method)
승욱 정
 
[Swift] Prototype
Bill Kim
 
17 swift 프로토콜
Changwon National University
 
I os 2
Sanghoon Han
 
Swift 3 Programming for iOS : class and structure
Kwang Woo NAM
 
Swift3 typecasting nested_type
Eunjoo Im
 
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
[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
 
PDF
[Swift] Data Structure - Heap
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
 
[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
 
[Swift] Data Structure - Heap
Bill Kim
 
Ad

[Swift] Protocol (2/2)

  • 2. 목차 •Delegation •Adding Protocols Conformance with an Extension •Collections of Protocol Types •Protocol Inheritance •Class-Only Protocols •Protocol Composition •Optional Protocol Requirements •Protocol ExtensionsChecking for Protocol Conformance •References
  • 3. Delegation 위임(Delegation)은 클래스 혹은 구조체 인스턴스에 특정 행위에 대한 책임을 넘길 수 있게 해 주는 디자인 패턴 중 하나입니다. class Dice { } protocol DiceGame { var dice: Dice { get } func play() } // DiceGameDelegate에 선언해서 실제 DiceGame의 행위와 관련된 구현을 // DiceGameDelegate를 따르는 인스턴스에 위임합니다. protocol DiceGameDelegate: AnyObject { func gameDidStart(_ game: DiceGame) func game(_ game: DiceGame, didStartNewTurnWithDiceRoll diceRoll: Int) func gameDidEnd(_ game: DiceGame) } class SnakesAndLadders: DiceGame { var dice: Dice = Dice() weak var delegate: DiceGameDelegate? func play() { delegate?.gameDidStart(self) } func end() { delegate?.gameDidEnd(self) } }
  • 4. Delegation class DiceGameTracker: DiceGameDelegate { var numberOfTurns = 0 func gameDidStart(_ game: DiceGame) { } func game(_ game: DiceGame, didStartNewTurnWithDiceRoll diceRoll: Int) { } func gameDidEnd(_ game: DiceGame) { } } let tracker = DiceGameTracker() let game = SnakesAndLadders() game.delegate = tracker game.play()
  • 5. Adding Protocols Conformance with an Extension 이미 존재하는 타입에 새 프로토콜을 따르게 하기 위해 익스텐션을 사용할 수 있습니다. 원래 값에 접근 권한이 없어도 익스텐션을 사용해 기능을 확장할 수 있습니다. class Dice { let sides: Int init(sides: Int) { self.sides = sides } } protocol TextRepresentable { var textualDescription: String { get } } extension Dice: TextRepresentable { var textualDescription: String { return "A (sides)-sided dice" } } let d12 = Dice(sides: 12) print(d12.textualDescription) // Prints "A 12-sided dice"
  • 6. Adding Protocols Conformance with an Extension 만약 어떤 프로토콜을 충족에 필요한 모든 조건을 만족하지만 아직 그 프로토콜을 따른다는 선언을 하지 않았다면 그 선언을 빈 익스텐 션으로 선언할 수 있습니다. protocol TextRepresentable { var textualDescription: String { get } } struct Hamster { var name: String var textualDescription: String { return "A hamster named (name)" } } // Hamster 인스턴스인 simonTheHamster는 이제 TextRepresentable 타입으로 사용할 수 있습니다. extension Hamster: TextRepresentable {} let simonTheHamster = Hamster(name: "Simon") let somethingTextRepresentable: TextRepresentable = simonTheHamster print(somethingTextRepresentable.textualDescription) // A hamster named Simon
  • 7. Collections of Protocol Types 프로토콜을 Array, Dictionary등 Collection 타입에 넣기위한 타 입으로 사용할 수 있습니다. let d12 = Dice(sides: 12) let simonTheHamster = Hamster(name: "Simon") let things: [TextRepresentable] = [d12, simonTheHamster] for thing in things { print(thing.textualDescription) // A 12-sided dice // A hamster named Simon }
  • 8. Protocol Inheritance 클래스 상속같이 프로토콜도 상속할 수 있습니다. 여러 프로토콜을 상속받는 경우 콤마(,)로 구분합니다. protocol InheritingProtocol : SomeProtocol, AnotherProtocol { // protocol definition goes here } protocol PrettyTextRepresentable : TextRepresentable { var prettyTextualDescription: String { get } }
  • 9. Class-Only Protocols 구조체, 열거형에서 사용하지 않고 클래스 타입에만 사용가능한 프 로토콜을 선언하기 위해서는 프로토콜에 AnyObject를 추가합니 다. protocol SomeClassOnlyProtocol: AnyObject, SomeInheritedProtocol { // class-only protocol definition goes here }
  • 10. Protocol Composition 동시에 여러 프로토콜을 따르는 타입을 선언할 수 있습니다. protocol Named { var name: String { get } } protocol Aged { var age: Int { get } } struct Person: Named, Aged { var name: String var age: Int } func wishHappyBirthday(to celebrator: Named & Aged) { print("Happy birthday, (celebrator.name), you're (celebrator.age)!") } let birthdayPerson = Person(name: "Malcolm", age: 21) wishHappyBirthday(to: birthdayPerson) // Happy birthday, Malcolm, you're 21!
  • 11. Optional Protocol Requirements 프로토콜을 선언하면서 필수 구현이 아닌 선택적 구현 조건을 정의 할 수 있습니다. 이 프로토콜의 정의를 위해서 @objc 키워드를 프로토콜 앞에 붙이 고, 개별 함수 혹은 프로퍼티에는 @objc와 optional 키워드를 붙 입니다. @objc 프로토콜은 클래스 타입에서만 채용될 수 있고 구조체나 열 거형에서는 사용할 수 없습니다. @objc protocol CounterDataSource { @objc optional func increment(forCount count: Int) -> Int @objc optional var fixedIncrement: Int { get } }
  • 12. Protocol Extensions 익스텐션을 이용해 프로토콜을 확장할 수 있습니다. protocol RandomNumberGenerator { func random() -> Double } extension RandomNumberGenerator { func randomBool() -> Bool { return random() > 0.5 } } class LinearCongruentialGenerator: RandomNumberGenerator { var lastRandom = 42.0 let m = 139968.0 let a = 3877.0 let c = 29573.0 func random() -> Double { lastRandom = ((lastRandom * a + c).truncatingRemainder(dividingBy:m)) return lastRandom / m } } let generator = LinearCongruentialGenerator() print("Here's a random number: (generator.random())") // Prints "Here's a random number: 0.3746499199817101” print("And here's a random Boolean: (generator.randomBool())") // Prints "And here's a random Boolean: true"
  • 13. Protocol Extensions 프로토콜 익스텐션이 특정 조건에서만 적용되도록 선언할 수 있습니 다. 이 선언에는 where 절을 사용합니다. 다음은 Collection 엘리먼트가 Equatable인 경우에만 적용되는 allEqual()메소드를 구현한 예입니다. extension Collection where Element: Equatable { func allEqual() -> Bool { for element in self { if element != self.first { return false } } return true } } let equalNumbers = [100, 100, 100, 100, 100] let differentNumbers = [100, 100, 200, 100, 200] print(equalNumbers.allEqual()) // true print(differentNumbers.allEqual()) // false
  • 14. References [1] [Swift]Protocols 정리 : http://minsone.github.io/mac/ ios/swift-protocols-summary [2] Protocols : https://docs.swift.org/swift-book/ LanguageGuide/Protocols.html [3] Swift ) Protocols (4) : https://zeddios.tistory.com/347 [4] Swift Protocol 적재적소에 사용하기 : https:// academy.realm.io/kr/posts/understanding-swift- protocol/ [5] Swift 4.2 Protocol 공식 문서 정리 : https:// medium.com/@kimtaesoo188/swift-4-2-protocol-공식-문서- 정리-f3a97c6f8cc2
  • 15. References [6] 프로토콜 (Protocols) : https://jusung.gitbook.io/the- swift-language-guide/language-guide/21-protocols [7] 오늘의 Swift 상식 (Protocol) : https://medium.com/ @jgj455/오늘의-swift-상식-protocol-f18c82571dad [8] [Swift] Protocol [01] : https://baked- corn.tistory.com/24 [9] [Swift] Protocol [02] : https://baked- corn.tistory.com/26 [10] Swift – 프로토콜 지향 프로그래밍 : https:// blog.yagom.net/531/