Skip to content

Commit

Permalink
ExistentialType 글 들여쓰기 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jalynneyoon committed Aug 6, 2024
1 parent b70670e commit dc78f9f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions _posts/2024-08-06-[Swift] existential type.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ protocol 선언 후 채택하여 함수를 사용한다고 생각해 보자.

```swift
protocol Testable {
func test()
func test()
}

struct A: Testable {
func test() {
print("A Test")
}
func test() {
print("A Test")
}
}

struct B: Testable {
func test() {
// 테스트
}
func test() {
// 테스트
}
}
```

Expand All @@ -36,12 +36,12 @@ struct B: Testable {
```swift
// generic 활용
func test<T: Testable>(with test: T) {
test.test()
test.test()
}

// existential type 을 활용
func test(with test: any Testable) {
test.test()
test.test()
}

var test: any Testable = A()
Expand Down

0 comments on commit dc78f9f

Please sign in to comment.