
iOS 개발을 하다보면 자식객체에서 부모객체에게 메시지를 보내야 할때가 생긴다. 그럴땐 보통 delegate 패턴을 사용한다. class MySampleDelegateParentsClass: MySampleDelegateChildClassDelegate { var child: MySampleDelegateChildClass init() { self.child = MySampleDelegateChildClass() self.child.delegate = self } func sendMessage(foo: String) { print("recived: \(foo)") } } protocol MySampleDelegateChildClassDelegate: AnyObject { func sendMessage(f..

Swift에서 각종 기본컨트롤러를 이용하다보면 Delegate를 확장하고싶을때가 있다. 예를들면.. UITableView의 Delegate는 UITableViewDelegate라는 Protocol이고, UITableView는 UIScrollView를 상속받는다. UITableViewDelegate는 UIScrollViewDelegate라는 프로토콜을 따르며, 거기에 자신만의 요구하는 함수 프로토콜을 가지고있다. 그렇다면 저 UITableView처럼 UITableView를 상속받는 뷰컨트롤러를 만들고 UITableViewDelegate를 따르는 프로토콜을 만든 후 delegate를 그 프로토콜로 바꿔주면 되는거 아닌가?!?! import Foundation import UIKit protocol MyTab..
- Total
- Today
- Yesterday
- modulemap
- 니모닉
- SwiftUI
- widget extension
- Objective-C
- iOS 니모닉
- Tuist
- iOS Mnemonic
- Swift 니모닉
- Secure Enclave
- flatMap
- module map
- RxSwift
- associated type
- arc
- Delegate
- XCode Cloud
- cd
- cicd
- Fastlane
- firebase distribution
- isSecureTextEntry
- ios
- Gitlab Runner
- 순환참조
- XCodeGen
- swift
- Protocol
- iOS wallet
- CI
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |