Skip to content

Instantly share code, notes, and snippets.

@leptos-null
Created September 19, 2019 05:10
Show Gist options
  • Save leptos-null/21837fe407d8d2620698b1530e56abd8 to your computer and use it in GitHub Desktop.
Save leptos-null/21837fe407d8d2620698b1530e56abd8 to your computer and use it in GitHub Desktop.
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