v1.1.2
Overview
This release adds a couple of quality-of-life improvements to VSM
Observing Generic Publishers
You can now observe generic publishers without having to erase them with .eraseToAnyPublisher()
, where applicable.
Old:
struct LoaderModel {
func load() -> AnyPublisher<MyViewState, Never> {
Just(.loading)
.merge(with: webRequestPublisher())
.eraseToAnyPublisher()
}
...
}
New:
struct LoaderModel {
func load() -> some Publisher<MyViewState, Never> {
Just(.loading)
.merge(with: webRequestPublisher())
}
...
}
KeyPath Support in MutatingCopyable
If you need to change a single value on a model's mutable property, you can now use a new overload on MutatingCopyable
(thanks to @bdunay3) that allows you to mutate by key path. This enables some interesting possibilities for working with key paths. At a minimum, it provides a more straight-forward spelling for changing a single value on a struct's mutable property in a single line of code.
New:
struct LoadedModel {
...
var isSaving: Bool = false
func save(newValue: String) -> some Publisher<MyViewState, Never> {
Just(.loaded(self.copy(mutatingPath: \.isSaving, value: true)))
.merge(with: savePublisher(forValue: newValue))
}
...
}
What's Changed
- Maintenance by @albertbori in #38
- Observe Some (Generic) Publisher by @albertbori in #39
- Update sersoft-gmbh/xcodebuild-action action to v3 by @renovate in #40
- Mutatingcopyable keypath by @bdunay3 in #41
Full Changelog: v1.1.1...v1.1.2