Replies: 2 comments 2 replies
-
@fbp93 Is this for UIKit? What do you mean by unsafe? Here is an alternate version of your extension using extension Store {
public func unwrap<Wrapped>() -> Store<Wrapped, Action>? where State == Wrapped? {
var unwrapped: Store<Wrapped, Action>?
_ = self.ifLet { unwrapped = $0 }
return unwrapped
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @fbp93! This is precisely what @iampatbrown's I'm going to convert this to a discussion since it's a question about library use and we like to keep the issues section focussed on bugs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to perform a scope where the state is optional and being able to transform a
Store<State?, Action>
intoStore<State, Action>?
.To avoid some manual unwrap, I tried to add some syntactic sugar, here is how I did it:
The problem is that solution is not safe and the
publisherScope
is deprecated.What about adding a safe API to retrieve an optional store from an optional state?
Beta Was this translation helpful? Give feedback.
All reactions