Throttler

public final class Throttler

Schedules task on the main thread with throttling. Each subsequent task scheduled earlier than throttle interval expired, would cancel out the previous task. This class is not thread-safe, so all calls to it should be performed within the same thread.

Important

This is a Public Preview API. It may be changed or removed at any time.

Public

  • Schedules the specified block after the throttling interval on the main thread. The block is called if the throttle function wasn’t called for interval seconds. WARNING: When using this method you must take care of reference cycles!

    Declaration

    Swift

    public func throttle(_ block: @escaping () -> ())