Prep the pan and oven. Heat the oven to 350°F (175°C). Grease a 9x9-inch baking pan or line it with parchment, leaving overhang for easy lifting.
Prep the apples. Peel, core, and dice the apples into small pieces (about 1/2-inch). Toss them with 1 tablespoon flour and 1/2 teaspoon cinnamon.
This helps them stay suspended in the batter.
Mix the dry ingredients. In a large bowl, whisk 2 cups flour, baking powder, salt, granulated sugar, and 1/4 teaspoon cinnamon.
Make the wet mixture. In a separate bowl, whisk melted butter, eggs, milk, and vanilla until smooth. The butter should be melted but not hot.
Combine batter. Pour the wet mixture into the dry ingredients. Stir gently until no dry streaks remain.
Fold in the prepared apples and optional nuts. The batter will be thick.
Make the cinnamon swirl. In a small bowl, mash together 3 tablespoons softened butter, 1/3 cup brown sugar, and 1 1/4 teaspoons cinnamon until a thick paste forms.
Assemble the cake. Spread half the batter in the pan. Dollop half the cinnamon mixture over the batter in small spoonfuls.
Add the remaining batter on top, then dot with the remaining cinnamon mixture.
Swirl. Use a butter knife to gently swirl the cinnamon mixture through the batter, making S-shaped motions. Don’t overmix—distinct ribbons bake up beautifully.
Bake. Place the pan on the center rack and bake for 32–40 minutes, or until a toothpick inserted near the center comes out with a few moist crumbs. If the top browns too quickly, tent with foil for the last 5–10 minutes.
Mix the glaze. While the cake cools for 10 minutes, whisk powdered sugar with 2 tablespoons milk or cream and 1/2 teaspoon vanilla until smooth and pourable.
Add a splash more liquid if needed.
Finish and serve. Drizzle the warm cake with glaze. Slice and serve slightly warm for the best texture and flavor.