This is a simple queue with Infinite or limit length and also dequeue periodic with timer for iOS platforms Edit Add topics
HJQueue queue = [[HJQueue alloc] initInfiniteLength];
[queue setDelegate:self];
queue :
[queue enqueue:@(++_counter)]
dequeue :
NSString *obj = [queue dequeue];
Time interval: interval is per second.
[queue setQueueTimeInterval:60];
Dequeue count: dequeue periodic with arrayOfObjects with set dequeueCount :
_queue.dequeueCount = 10;
delegate : dequeue just single object :
-(void) dequeueWithTick:(id)object{
NSLog([NSString stringWithFormat:@"Dequeue periodic ('%.01f') with value : %@ \n",
[queue queueTimeInterval],object]);
}
dequeue arrayOfObjects with set dequeueCount :
-(void) dequeueArrayWithTick:(NSArray<id> *)objects{
NSString *message = @"";
for (id object in objects) {
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@ \n",object]];
}
NSLog([NSString stringWithFormat:@"%@ Dequeue periodic ('%.01f') with value : %@ \n",_logTextView.text,[_queue queueTimeInterval],message]);
}
Add the following to your Podfile
:
Install from CocoaPod.
pod 'TimerHJQueue', '~> 1.0.2'
Then run pod install
.