Skip to content

aligungor/Poller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Poller

A lightweight and customizable polling utility using Combine.

πŸ“¦ Features

  • βœ… Periodic event publishing using Combine
  • ⚑️ Optional immediate first fire (fireImmediately)
  • πŸ›‘ Easily start and stop polling
  • πŸ§ͺ Fully tested with XCTest

πŸ›  Installation

Swift Package Manager

Add the following to your Package.swift dependencies:

.package(url: "https://github.com/aligungor/Poller.git", from: "1.0.0")

Then add "Poller" to your target dependencies:

.target(
    name: "YourApp",
    dependencies: [
        .product(name: "Poller", package: "Poller")
    ]
)

Or use Xcode:

  1. File > Add Packages
  2. Paste the URL of this repo
  3. Choose version and add Poller to your target

πŸš€ Usage

import Poller
import Combine

let poller = Poller(interval: 1.0, fireImmediately: true)
var cancellables = Set<AnyCancellable>()

poller.publisher
    .sink {
        print("Tick")
    }
    .store(in: &cancellables)

poller.start()

// Stop polling when needed
poller.stop()

πŸ“‚ Structure

  • Sources/Poller β€” Core implementation
  • Tests/PollerTests β€” Unit tests

πŸ“„ License

MIT License. See LICENSE file for details.

About

A nice poller

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages