Coder Social home page Coder Social logo

each's Introduction

Each

Elegant ⏱ interface for Swift apps

BuddyBuild

Each is a NSTimer bridge library written in Swift.

Features

  • Completely configurable timers
  • Support for time intervals in ms, seconds, minutes and hours
  • Fully extendable
  • More readable and simple to use in comparison with NSTimer object

Requirements

  • iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build Each 1.0.0+.

To integrate Each into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
pod 'Each', '~> 1.0'
end

Then, run the following command:

$ pod install

Usage

Creating a new timer instance

let timer = Each(1).seconds     // Can be .milliseconds, .seconds, .minute, .hours  

Performing operations

timer.perform {
    // Do your operations
    // This closure has to return a Boolean value
    // Return false if you want to leave the timer active, otherwise
    // return true to invalidate it
}

Stopping the timer manually

timer.stop()    // This stops immediately the timer

Restarting the timer

You can restart the timer only after you stopped it. This method restarts the timer with the same perform closure.

timer.restart()

License

Each is released under the MIT license. See LICENSE for details.

each's People

Contributors

dalu93 avatar sjoness avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.