Skip to content

dmojdehi/PerformSelectorWithDebounce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PerformSelectorWithDebounce

A simple way to throttle messages spammed to an object.

This commonly happens when updating the UI from a event that may fire frequently.

For example, the handler for the 'value changed' event from a slider may be called extremely frequently.

- (IBAction)mySliderValueChanged
{
	[self updateUI];
}

Rather than update your UI 100 times per second, 10 times per second is perfectly adequate:

#import "PerformSelectorWithDebounce.h"

- (IBAction)mySliderValueChanged
{
	[self performSelector:@selector(updateUI) withDebounceDuration:0.1];
}

License: MIT

About

A simple way to throttle Objective-C messages. Implemented as a (yet another) category on NSObject.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors