Skip to content

PollingKit provides a polling mechanism that respects callback delays

License

Notifications You must be signed in to change notification settings

lukaswuerzburger/PollingKit

Repository files navigation

PollingKit
PollingKit

Swift Version Build Status CocoaPods Compatible License MIT

Contents

✍️ Description

The PollingController does the timed long-term polling for you and takes care that only one async operation is open at a time. If the async operation takes more time than the timer interval, it waits until the callback is invoked to continue.

🖥 Example

import PollingKit
let pollingController = PollingController(preferredInterval: 5) { callback in

    // Imagine an API call being made here.
    loadSomethingAsynchronously() {
        callback()
    }
}

🎟 Demo

This demo shows how the PollingController switches states.

PollingKit Demo

You can find this demo app in this repository.

💻 How to use

Cocoapods:
PollingKit is available on Cocoapods. Just put following line in your Podfile:

pod 'PollingKit'

Swift Package Manager:
Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/lukaswuerzburger/PollingKit.git", from: "2.0.0")
]

⚠️ Requirements

  • Swift 5+
  • iOS 10+
  • Xcode 13+

💪 Contribute

Issues and pull requests are welcome.

About

PollingKit provides a polling mechanism that respects callback delays

Resources

License

Stars

Watchers

Forks

Packages

No packages published