Post

Replies

Boosts

Views

Activity

Reply to Anyway to get the number of widgets installed?
This works for me:   func checkNumWidgetsInstalled() {     WidgetCenter.shared.getCurrentConfigurations { [weak self] result in       guard let strongSelf = self else { return }       switch result {         case let .success(widgets):           let myWidgetCount = widgets.count                       for widg in widgets {             let intent = widg.configuration as? WidgetConfigIntent             if let intent = intent {               print("Widget: \(widg) family: \(widg.family) kind: \(widg.kind) config: \(intent)")             }           }           DispatchQueue.main.async {             strongSelf.updateNumWidgetsInstalled(myWidgetCount)           }         case let .failure(error): print(error)       }     }   }       func updateNumWidgetsInstalled(_ count: Int) {     print("WIDGET COUNT: \(count)")     DataManager.saveNumWidgetsInstalled(count)     numWidgetsInstalled = count   }
Nov ’20