Swift μ dynamic dispatch λ method table μμ ν¨μλ₯Ό μ°Ύμ λ€μ indirect call μ μννμ¬ κ΅¬νλκΈ° λλ¬Έμ direct call λ³΄λ€ μνμ΄ λ립λλ€. λλ indirect call μ λ§μ μ»΄νμΌλ¬ μ΅μ νλ₯Ό λ°©μ§νμ¬ νΈμΆ λΉμ©μ΄ λΉμλλ€. κ·Έλ λ€λ©΄ μλΈν΄λμ±κ³Ό μ€λ²λΌμ΄λ©μ΄ νμμλ κ²½μ°λ static dispatch λ‘ λμνλ κ²μ΄ μ’μ§ μμκΉ? λ§μ΅λλ€, μ±λ₯μ΄ μ€μν μ½λμμ μ±λ₯ ν₯μμ νμνμ§ μμ λ μ΄ dynamic dispatch λμμ μ νν μ μλ λ°©λ²μ΄ νμν©λλ€. μ±λ₯ ν₯μμ μν Static Dispatch λ©μλ λΏλ§ μλλΌ νλ‘νΌν° μμ μ€λ²λΌμ΄λ©μ κ°λ₯μ±μ΄ μκΈ° λλ¬Έμ dynamic dispatch λ‘ λμν©λλ€. κ·Έλμ μμ κ°λ₯..
Method Dispatch method dispatch λ Swift μμ λ©μλλ₯Ό νΈμΆν λ νμ¬ λ©λͺ¨λ¦¬μμ μ΄λ»κ² μ΄λ€ λ©μλλ₯Ό μ€νμν¬μ§λ₯Ό κ²°μ ν λ μ¬μ©νλ λ°©λ²μ λλ€. ν΄λμ€μ dispatch κ³Όμ μ μμλ₯Ό λ€μ΄λ΄ μλ€. class Animal { func bark() { print("bark!") } } class Cow: Animal { func bark() { print("moo!") } } class Dog: Animal { } let animal: Animal = Animal() animal.bark() let cow: Animal = Cow() cow.bark() let dog: Animal = Dog() dog.bark() μΈμ€ν΄μ€ animal, cow, dog κ° bark() λ©μλ..
- CloneCoding
- WWDC22
- urlsession
- Objective-C
- Swift
- rxswift
- YPImagePicker
- async/await
- watchOS
- MOYA
- WidgetKit
- μλ²ν΅μ
- UserDefaults
- projectsetting
- WWDC
- Algorithm
- MVVM
- github
- Protocol
- RxCocoa
- configurable widget
- APNS
- Firebase
- containerBackground
- IOS
- Widget
- OpenSourceLibrary
- 2022 KAKAO TECH INTERNSHIP
- SwiftUI
- Notification
μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Total
- Today
- Yesterday