Is this the way to go?
class UserStore: ObservableObject {
@Published var isPremium: Bool
init(id objectID: NSManagedObjectID,
in context: NSManagedObjectContext) {
if let currentUser = try? context.existingObject(with: objectID) as? User {
self.isPremium = currentUser.isPremium
} else {
log.info("No user with \(objectID) exists")
}
}
}