To prepare the patties, combine the ground beef, grated onion, garlic, salt, finely chopped rosemary, and freshly ground black pepper in a medium-sized mixing bowl.
Gently mix them together until just combined, being careful not to overmix.
Preheat the air fryer to 200°C (390°F).Divide the mixture into 4 portions, each weighing approximately 215 grams, and shape them into patties about 1 ½ cm (½") thick.
Make a slight indentation in the center of each patty and place them in the preheated air fryer in a single layer. If your air fryer basket is not large enough, cook the patties in batches.
Cook the patties for 5 minutes, then flip them over and cook for an additional 4-6 minutes until they are cooked through.
If you want to add cheese to your burgers, turn off the air fryer, place a slice of cheese on each patty, close the air fryer, and let the cheese melt for an additional minute.
Once cooked, remove the patties from the air fryer, place them on buns, and add your favorite toppings and sauces before serving.