A timer that doesn't retain the target.
Branch: master
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.
ZYGCDTimer
ZYGCDTimerDemo.xcodeproj
ZYGCDTimerDemo
fastlane
.gitignore
LICENSE
README.md
ZYGCDTimer.podspec

README.md

ZYGCDTimer

Version License Platform

ZYGCDTimer is based on the MSWeakTimer.

Features

  • Create a timer with block

  • Pause the timer

Example

To run the example project, clone the repo, and run directly.

Requirements

iOS 8.0 or later

Installation

ZYGCDTimer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ZYGCDTimer"

Usage

You can use the following method to create a timer, and then use the "fire" method to start the timer.

  • Target-selector
+ (nonnull instancetype)timerWithTimeInterval:(NSTimeInterval)interval
                                       target:(nonnull id)aTarget
                                     selector:(nonnull SEL)aSelector
                                     userInfo:(nullable id)userInfo
                                      repeats:(BOOL)repeats
                                dispatchQueue:(nonnull dispatch_queue_t)dispatchQueue;
  • Block
+ (nonnull instancetype)timerWithTimeInterval:(NSTimeInterval)interval
                                     userInfo:(nullable id)userInfo
                                      repeats:(BOOL)repeats
                                dispatchQueue:(nonnull dispatch_queue_t)dispatchQueue
                                        block:(nonnull ZYGCDTimerCallbackBlock)block;

Author

ripperhe, ripperhe@qq.com

License

ZYGCDTimer is available under the MIT license. See the LICENSE file for more info.