반응형
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
- subject
- NavigationLink
- ios14
- nonisolated
- RxSwift
- vim
- URL(string:)
- @Binding
- init?
- Operater
- Operators
- Creating Operators
- @EnvironmentObject
- dismiss
- Bug
- RFC1738/1808
- nestjs
- init
- SwiftUI
- @Environment
- IOS
- Xcode
- RxCocoa
- NullObject
- typeorm
- operator
- graphql
- SWIFT
- swift6
- @State
Archives
- Today
- Total
Tunko Development Diary
RxSwift) AsyncSubject 란? 본문
AsyncSubject 는 이벤트가 전달되는 시점이 다릅니다. 구독한 시점에 이벤트가 전달되는것이 아닌 Complite 이벤트가 전달되면 가장 마지막 이벤트가 전달됩니다.
let disposeBag = DisposeBag()
enum MyError: Error {
case error
}
let subject = AsyncSubject<Int>()
subject
.subscribe { print($0) }
.disposed(by: disposeBag)
subject.onNext(1)
subject.onNext(2)
subject.onNext(3)
subject.onCompleted()
//subject.onError(MyError.error)
출력
next(3)
completed
만약 onCompleted가 아닌 onError이벤트가 전달되면 error 만 전달됩니다.
반응형
'Development > RxSwift' 카테고리의 다른 글
RxSwift) Creating Operators (repeatElement, deferred, create) (0) | 2022.05.31 |
---|---|
RxSwift) Relay (RxSwift 6) (0) | 2022.05.30 |
RxSwift) ReplaySubject 란? (0) | 2022.05.30 |
RxSwift) BehaviorSubject 란? (0) | 2022.05.30 |
RxSwift) PublishSubject 란? (0) | 2022.05.30 |