Elegant Timer in Swift
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Every
Sample
.gitignore
.swift-version
Every.podspec
LICENSE
README.md

README.md

Introduction

Every is an elegant timer in Swift.

Requirements

  • iOS 8.0+
  • watchOS 2.0+
  • tvOS 9.0+
  • macOS 10.10+
  • Xcode 9 with Swift 4

Installation

CocoaPods

use_frameworks!
pod 'Every'

Usage

import Every
var counter = 0
Every(1).seconds.do { () -> Every.NextStep in
    counter += 1
    guard counter <= 4 else {
        print("STOP")
        return .stop
    }
    print(counter)
    return .continue
}
// 1
// 2
// 3
// 4
// STOP