Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- RxCocoa
- uiscrollview
- Clean Code
- Human interface guide
- 스위프트
- map
- SWIFT
- uitableview
- rxswift
- collectionview
- swift documentation
- HIG
- Refactoring
- 클린 코드
- tableView
- ios
- Observable
- Xcode
- UICollectionView
- ribs
- 리펙토링
- 애니메이션
- UITextView
- MVVM
- Protocol
- swiftUI
- 리펙터링
- 리팩토링
- clean architecture
- combine
Archives
- Today
- Total
목록.self (1)
김종권의 iOS 앱 개발 알아가기
[iOS - swift] Metatype (메타 타입), generics (제네릭)
파라미터에 타입을 받고 싶은 경우? 함수 파라미터로 instance로 받는 예제 printType(of: "123") // 123 func printType(of instance: T) { print(instance) } 함수 파라미터로 type을 받고 싶은 경우 - metatype사용 type(of:): 파라미터는 인스턴스이고, 반환값은 타입 T.Type: 인스턴스가 아닌 타입 printType(of: type(of: "123")) // String func printType(of instance: T.Type) { print(instance) } Metatype이 있어야 하는 이유: 함수 내에서 타입을 파라미터로 받아서 캐스팅이 필요한 경우, switch로 타입값을 구분해야하는 경우 Metatype ..
iOS 기본 (swift)
2021. 1. 29. 01:13