Skip to content

windtersharp/NSTimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CocoaPods Compatible License Platform

This library provides a category for NSTimer. You don't need to invoke the invalidate method in timer manually, which can avoid memory leak that caused by circular reference.

Installation

NSTimer supports CocoaPods for installing the library in a project.

Podfile

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

source 'https://github.com/CocoaPods/Specs.git'
target 'TargetName' do
  pod 'WTTimer'         
end

Then, run the following command:

$ pod install

Usage

It is the same as the system native method, and you don't need to invoke the invalidate method in timer manually,

   
NSTimer  *timer = [NSTimer wt_scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(log) userInfo:nil repeats:YES];
[timer invalidate]; // Not necessary

About

A Category of NSTimer can avoid memory leak

Resources

License

Stars

Watchers

Forks

Packages

No packages published