because of a requirement to auto remove Text
after its appearance in 2 seconds, I want to write this operator but still cannot figure out the best way to implement.
We can put a timespan parameter and get a new stream, here are two interfaces need to implement
extension Publisher {
func reset<T, S: Scheduler>(
after: S.SchedulerTimeType.Stride,
on scheduler: S
) -> AnyPublisher<T, Failure> where Output == Optional<T> {
// implementation
}
func autoToggle<S: Scheduler>(
after: S.SchedulerTimeType.Stride,
on scheduler: S
) -> AnyPublisher<Bool, Failure> {
// implementation
}
}
Really appreciate your help.