Wrapper for Combine.PassthroughSubject
that forces failure type to Never
, so you don't need to write it every time you declare publisher type.
Before:
let exampleSubject = PassthroughSubject<Bool, Never>()
After:
let exampleSubject = PublishSubject<Bool>()
Wrapper for Combine.CurrentValueSubject
that forces failure type to Never
, so you don't need to write it every time you declare publisher type.
Before:
let exampleSubject = CurrentValueSubject<Bool, Never>(false)
After:
let exampleSubject = ValueSubject<Bool>(false)
Simplifies dropping publisher values with mapping them to Void()
. Reduces usage of empty arguments and braces in code for better readability.
Before:
exampleSubject
.map { _ in Void() }
.sink {}
After:
exampleSubject
.asVoid()
.sink {}
Simplifies dropping nil
values in publisher with optional output type. Reduces usage of short braces in code for better readability.
Before:
exampleOptionalSubject
.compactMap { $0.value }
.sink {}
After:
exampleOptionalSubject
.filterNil()
.sink {}
Simplifies subscribing to first not nil value in publisher with optional output type. Reduces usage of short braces in code for better readability.
Before:
exampleOptionalSubject
.first { $0.value != nil }
.sink {}
After:
exampleOptionalSubject
.firstNotNil()
.sink {}