According to what apple says about widgetPerformUpdateWithCompletionHandler:, the iOs Widget can update his content also when the widget is not visible.
Call your API in func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) method and call the completionHandler(NCUpdateResult.newData) .