Sum of an attribute in CoreData

Hey team, I’m trying to sum up some attributes in CoreData on my app project, I’ve found multiple different responses on google and none of them work. I have tried researching to see if that’s because the responses are outdated, or maybe the way I’m using CoreData is outdated. Basically in my app, basketball players will go shoot hoops and record makes and takes in my app. So mid range is an entity, and “makes” and “takes” are the attributes. How can I get the sum of all makes and takes to display on the home page?

This is how I get context
static let context: NSManagedObjectContext = {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
let persistentContainer = appDelegate.persistentContainer
let context = persistentContainer.viewContext
return context

This is how I retrieve an entity
static func retrieveMidShootarounds() -> [MidShootaround] {
do {
let fetchRequest = NSFetchRequest(entityName: “MidShootaround”)
let results = try context.fetch(fetchRequest)
return results
} catch let error {
print(“Could not fetch (error.localizedDescription)”)

Let me know if you want more