Closed albertbori closed 9 months ago
This PR introduces a small change which allows the observation of some Publisher<Value, Failure> instead of explicitly requiring AnyPublisher<Value, Failure>. This helps reduce the amount of typing when building view state models.
some Publisher<Value, Failure>
AnyPublisher<Value, Failure>
Previous:
struct LoaderModel { func load() -> AnyPublisher<MyViewState, Never> { Just(.loading) .merge(with: webRequestPublisher()) .eraseToAnyPublisher() } }
Current as of this PR:
struct LoaderModel { func load() -> some Publisher<MyViewState, Never> { Just(.loading) .merge(with: loadPublisher()) } }
Prior to this PR, the above code would cause an error if you tried to observe that function like so:
$state.observe(loaderModel.load())
Description
This PR introduces a small change which allows the observation of
some Publisher<Value, Failure>
instead of explicitly requiringAnyPublisher<Value, Failure>
. This helps reduce the amount of typing when building view state models.Previous:
Current as of this PR:
Prior to this PR, the above code would cause an error if you tried to observe that function like so:
Type of Change
Checklist