iOS) Protocol ์์ฑ ์ AnyObject ์์๋ฐ๊ธฐ
Delegate ํจํด์ ์ฌ์ฉํ๋ฉด์ Protocol ์ ๋ง๋ค์๋ค. ๊ทธ๋ฐ๋ฐ SwiftLint ์์ ๋ค์๊ณผ ๊ฐ์ด ๊ฒฝ๊ณ ๊ฐ ๋ฐ์ํ๋ค! delegate ๋ reference cycle ์ ํผํ๊ธฐ ์ํด์ weak(์ฝํ ์ฐธ์กฐ)๋ฅผ ์ฌ์ฉํด์ผ ํ๋ค. delegate protocol ์ weak(์ฝํ ์ฐธ์กฐ)๋ฅผ ์ํด์ ํด๋์ค ์ ์ฉ ์ด์ด์ผ ํ๋ค. Delegate ๋ฅผ weak ๋ก ์ ์ธํ์ ์ธ์คํด์คํ ํด์ ์ฐธ์กฐํ ๋ Retain ์ด ์๊ธด๋ค๊ณ ํด์. ๊ทธ๋ฐ๋ฐ protocol ์ ํด๋์ค๋ ๊ตฌ์กฐ์ฒด์ฒ๋ผ ์ธ์คํด์คํ ๋๋ ๊ฒ์ด ์๋๋ฐ ์ Retain cycle ์ด ์๊ธฐ๋๊ฑธ๊น์? ์๋ฅผ ๋ค์ด ํด๋์ค a์ b๊ฐ ์๋ก๋ฅผ protocol ๋ก ์ฐธ์กฐํ๊ฒ ๋๋ฉด ๊ฐํ ์ฐธ์กฐ๊ฐ ๋๋ฉด์ Retain Cycle ์ด ๋ฐ์ํ๋๊ฑฐ์ฃ ! ๊ทธ๋์ weak ๋ฅผ ์ ์ธํด์ refer..
iOS
2021. 11. 11. 17:30
TAG
- Swift
- Widget
- APNS
- async/await
- watchOS
- rxswift
- Notification
- projectsetting
- UserDefaults
- MOYA
- CloneCoding
- ์๋ฒํต์
- 2022 KAKAO TECH INTERNSHIP
- WWDC22
- YPImagePicker
- Objective-C
- RxCocoa
- Protocol
- github
- IOS
- containerBackground
- WWDC
- SwiftUI
- OpenSourceLibrary
- WidgetKit
- MVVM
- Firebase
- urlsession
- Algorithm
- configurable widget
์ต๊ทผ์ ์ฌ๋ผ์จ ๊ธ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
๊ธ ๋ณด๊ดํจ
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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