Both CurrentValueSubject and @Published.Publisher (retrieved via $ from an ObservableObject property) immediately send a notification with the current value when a new subscriber is added (verified with this example).
Is there a way to require this behaviour with a protocol?
For example, if you offer an initializer that requires to pass a publisher, one would use AnyPublisher here:
init(settings: AnyPublisher<Settings, Never>) {
// ...
}
This would allow to be sneaky and pass in a PassthroughSubject erased to AnyPublisher. Is there a way to prevent this that would allow to pass in both a CurrentValueSubject or an @Published property? (something like a AnyValuePublisher?)