Widgets have a maximum peak memory usage of 30Mb. If this is exceeded, they will crash and you'll see a placeholder instead.
Implementation
Added public func fetchWidgetsData(completion: @escaping (Bool) -> Void) to DataManager in order to get only some basic data from JHU. This was implemented in order to reduce memory usage and keep it under the 30Mb limit;
Implemented two sizes of widgets: .systemSmall and .systemMedium that provide data by country. If no country is selected, they display Worldwide data;
Refresh is once per hour. This is not a guarantee since the OS decides if it should refresh the widgets or not depending on the device conditions. Only thing we can do is to specify a TimelineReloadPolicy equal to .after(nextRefreshDate) where nextRefreshDate is 1 hour after the current date;
Widgets have deep links that will open the application and display the country selected on the widget (there's an issue in the current version of the app where after an update the selected country will be deselected; hopefully it will be fixed soon). The format of the deep link is:
Notes
Widgets have a maximum peak memory usage of 30Mb. If this is exceeded, they will crash and you'll see a placeholder instead.
Implementation
public func fetchWidgetsData(completion: @escaping (Bool) -> Void)
toDataManager
in order to get only some basic data from JHU. This was implemented in order to reduce memory usage and keep it under the 30Mb limit;.systemSmall
and.systemMedium
that provide data by country. If no country is selected, they displayWorldwide
data;TimelineReloadPolicy
equal to.after(nextRefreshDate)
wherenextRefreshDate
is 1 hour after the current date;