This library supports convenient operators of RxSwift / RxCooca.
The list of supported operators is here.
- Xcode 12.x
- Swift 5.x
dependencies: [
.package(url: "https://github.com/Woin2ee-Modules/RxSwiftSugar.git", .upToNextMajor(from: "1.0.0"))
]
func asDriverOnErrorJustComplete() -> Driver<Element>
func asSignalOnErrorJustComplete() -> Signal<Element>
// when Element == Void
func asDriverOnErrorJustNext() -> Driver<Void>
func asSignalOnErrorJustNext() -> Signal<Void>
func mapToVoid() -> AnyObservableType<Void>
func mapToAny() -> AnyObservableType<Any>
func doOnNext(_ block: ((Element) throws -> Void)?) -> AnyObservableType<Element>
func doOnCompleted(_ block: (() throws -> Void)?) -> AnyObservableType<Element>
func doOnSuccess(_ block: ((Element) throws -> Void)?) -> Single<Element>
func startWith(_ block: () -> Element) -> SharedSequence<SharingStrategy, Element>
.startWith {
if text.isEmpty {
return "A"
} else {
return "B"
}
}
func unwrapOrThrow<Result>() -> AnyObservableType<Result>
array
.map(\.first)
.unwrapOrThrow() // If nil, throw error.
func andThenJustNext() -> Single<Void>
signOut() // Will return `CompletableEvent.completed`
.andThenJustNext() // Use it if want `next` event.
func catchAndThenJustNext() -> Single<Void>
delete() // Will return `CompletableEvent.error`
.catchAndThenJustNext() // Use it if want `next` event.