Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

acoomans/Hourglass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hourglass

iOS library for testing if a time interval is elapsed.

Usage

Execute a block if some 3 seconds elapsed since last time we run the hourglass (or called hourglass_set, see below):

NSString *key = @"my_action";
hourglass_run(key, 3, ^{
	// do something if more than 3 seconds since last time we did _my_action_
}, ^{
	// do something if less than 3 seconds since last time we did _my_action_
});

Reset the hourglass:

hourglass_clear(key);

Set manually the hourglass:

hourglass_set(key);

Check manually if 5 seconds are elapsed:

BOOL isElapsed = hourglass_elapsed(key, 5);

Description

There are two different hourglasses:

  • Hourglass is a collection of dispatch-like functions
  • ACHourglass is class where you can set a time interval for a named condition and later check if enough time has passed for that condition.

The two are a little bit different and their usage. See documentation and headers for more.

Documentation

Note: Unfortunately, appledoc does not support functions; so, the dispatch-like hourglass is not documented by the following procedure.

install appledoc:

brew install appledoc

build the HourglassDocumentation target,

the documentation will be automatically added to Xcode.

About

iOS library for testing if a time interval is elapsed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors