mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
• Latest data is saved out to JSON at various points. • Technote on widget usage. • Widget target added.
1022 B
1022 B
Widget
Supported Widget Styles
The NetNewsWire iOS widget supports the systemSmall and systemMedium styles.
The systemSmall style displays the current Today and Unread counts; systemMedium displays the latest two articles along with current
Today and Unread count.
Passing Data from the App to the Widget
Data is made available to the widget by encoding JSON data and saving it to a file in a directory available to app extensions.
struct WidgetData: Codable {
let currentUnreadCount: Int
let currentTodayCount: Int
let latestArticles: [LatestArticle]
let lastUpdateTime: Date
}
struct LatestArticle: Codable {
let feedTitle: String
let articleTitle: String?
let articleSummary: String?
let feedIcon: Data? // Base64 encoded image data
let pubDate: String
}
When is JSON Data Saved?
- On
unreadCountDidChange - After a background refresh
- When the app enters the background
After JSON data is saved, Widget timelines are reloaded.