dalu93 / Each
- воскресенье, 23 октября 2016 г. в 03:12:55
Swift
Elegant ⏱ interface for Swift apps
Elegant
Each is a NSTimer bridge library written in Swift.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsCocoaPods 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'
endThen, run the following command:
$ pod installlet timer = Each(1).seconds // Can be .milliseconds, .seconds, .minute, .hours 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
}timer.stop() // This stops immediately the timerYou can restart the timer only after you stopped it. This method restarts the timer with the same perform closure.
timer.restart()Each is released under the MIT license. See LICENSE for details.