I have a publisher that my view's onReceive is subscribed to. Instead of duplicating logic in onAppear as well, I'd like the publisher in the onReceive to fire on first subscribe.
Is there a way to convert a publisher to a CurrentValueSubject? Here's what I'm trying to do:
var myPublisher: CurrentValueSubject<Void, Never> {
Just(()) // Error: Cannot convert return expression of type 'Just<()>' to return type 'CurrentValueSubject<Void, Never>'
}
Is this possible or a better way to do this?