Skip to content

Instantly share code, notes, and snippets.

@dimebt
Last active September 8, 2020 15:40
Show Gist options
  • Save dimebt/4c292b34d35ea4510398b5bbe81fecad to your computer and use it in GitHub Desktop.
Save dimebt/4c292b34d35ea4510398b5bbe81fecad to your computer and use it in GitHub Desktop.
public func timeline(with context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
// Generate a timeline consisting of one entry with reload policy after 1 min.
let currentDate = Date()
let nextUpdateDate = Calendar.current.date(byAdding: .minute,
value: 1,
to: currentDate)!
let entry = WalletWidgetEntry(date: currentDate)
let timeline = Timeline(entries: [entry], policy: .after(nextUpdateDate))
completion(timeline)
}
public func placeholder(in context: Context) -> Entry {
let entry = WalletWidgetEntry(date: Date())
return entry
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment