Contents
✍️ Description🖥 Example🎟 Demo💻 How to use⚠️ Requirements💪 Contribute
✍️ 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
pollingController = PollingController(preferredInterval: 5) { callback in
// Imagine an API call being made here.
loadSomethingAsynchronously() {
callback()
}
}
🎟 Demo
You can find this demo app in this repository.
💻 How to use
Cocoapods:
PollingController
is available on Cocoapods. Just put following line in your Podfile
:
pod 'PollingController'
Swift Package Manager:
Add the following to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/lukaswuerzburger/PollingController.git", from: "1.0.0")
]
⚠️ Requirements
- Swift 5+
- iOS 10+
- Xcode 11+
💪 Contribute
Issues and pull requests are welcome.