Fetch data from CoreData for iOS 14 widget
问题 I want to display data fetched from Core Data in a widget. But @FetchRequest doesn’t work on widgets. As I understand, we have to create an app group and make a shared persistent container. What I want to know is how to read (fetch) data on widgets from that shared persistent container or simply, how to display data fetched from Core Data in widgets . 回答1: First you need to create an AppGroup which will be used to create a Core Data Persistent Container (here is a good explanation how to do