Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The date used for previews on watchOS, primarily for complications
static NSDate *watchPreviewDate() {
static NSDateComponents *comps;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
comps = [NSDateComponents new];
comps.calendar = NSCalendar.autoupdatingCurrentCalendar;
comps.timeZone = NSTimeZone.localTimeZone;
comps.year = 2014;
comps.month = 9;
comps.day = 9;
comps.hour = 10;
comps.minute = 9;
comps.second = 30;
});
return comps.date;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.