Skip to content

Add DelaySubscription Operator #80

@Jackstone92

Description

@Jackstone92

Hi everyone,

It would be great if a Combine implementation of the DelaySubscription operator could be added to this repo in order to further reduce the number of missing operators when compared with other reactive libraries (eg. RxSwift as per the cheat sheet).

As we'd expect from existing implementations found in other libraries, this DelaySubscription operator would allow a subscription to be time-shifted. This means that rather than shifting all emissions of a publisher forward in time (as per the current Delay implementation), only the subscription would be delayed.

Using a real-world example of a live video streaming app to explain the desired difference, if the streaming source was emitting frames (a "hot" publisher), then using .delay(for: .seconds(3), scheduler: scheduler) would mean that when sinked on, frames would be received 3 seconds behind the actual emission. By using .delaySubscription(for: .seconds(3), scheduler: scheduler) this would mean that after the initial 3 second delay (where frames would be dropped), frames would then be received in real time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions