Last active
September 8, 2020 15:40
-
-
Save dimebt/4c292b34d35ea4510398b5bbe81fecad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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