티스토리 뷰
728x90
반응형
notification 이 프로젝트 내에서 퍼져있기 때문에 이름이 가끔 겹치기도 하고 내가 무슨 이름을 사용했는지 기억이 안나기도 했다.
그래서 extension 으로 Notification.Name 을 확장시켜서 사용해보기로 했다.
- NotificaationName+Extention
extension Notification.Name {
static let testNotification = Notification.Name(rawValue: "test")
}
- 사용할 때
// post
NotificationCenter.default.post(name: .testNotification, object: nil)
// observer
NotificationCenter.default.addObserver(self, selector: #selector(testMethod), name: .testNotification, object: nil)
출처 :
728x90
반응형
'iOS' 카테고리의 다른 글
iOS) UILabel 부분 글자 크기/폰트/색상/밑줄 설정하기 (0) | 2021.08.31 |
---|---|
iOS) 원하는 모서리만 cornerRadius 사용하기 (0) | 2021.08.31 |
iOS) UIView 에 transition animation 적용해보기 (0) | 2021.08.20 |
iOS) 애플리케이션의 Life Cycle (0) | 2021.08.17 |
iOS) Modal 의 Life Cycle (0) | 2021.08.14 |
댓글
TAG
- OpenSourceLibrary
- Notification
- UserDefaults
- rxswift
- WWDC
- Protocol
- IOS
- CloneCoding
- urlsession
- Widget
- projectsetting
- async/await
- MVVM
- 2022 KAKAO TECH INTERNSHIP
- watchOS
- SwiftUI
- Algorithm
- RxCocoa
- APNS
- Firebase
- containerBackground
- 서버통신
- WWDC22
- configurable widget
- YPImagePicker
- Swift
- github
- Objective-C
- MOYA
- WidgetKit
최근에 올라온 글
최근에 달린 댓글
글 보관함
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
링크
- Total
- Today
- Yesterday