TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Oct 2017 |
Maintained by Roman Kříž.
Simple component for updating time labels at right time.
Notifies you whenever given calendar unit will change. All is done by using Foundation framework. No magic stuff :)
Let's say you want to display time label, which will display hours and minutes. But to keep minutes in sync you have to setup timer, which will fire every second.
But with this library it will fire only one time per minute. Also it is easy to use:
// self.timeLabel is instance of UILabel
// self.dateFormatter is instance of NSDateFormatter
__weak __typeof(self) w_self = self;
self.calendarLink = [[RKCalendarLink alloc] initWithCalendarUnit:NSCalendarUnitMinute updateBlock:^{
w_self.timeLabel.text = [w_self.dateFormatter stringFromDate:[NSDate date]];
}];
To see it alive, download this repo and run example project.
NOTE: Mac is not tested, but it should work.
RKCalendarLink is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RKCalendarLink', '~> 0.1'
Roman Kříž, [email protected]
RKCalendarLink is available under the MIT license. See the LICENSE file for more info.