Preheat your oven to 175°C. Grease and flour a standard loaf tin.
In a medium bowl, whisk together the flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In a large mixing bowl, cream together the softened butter and granulated sugar until light and fluffy. Add the eggs, one at a time, beating well after each addition. Stir in the vanilla extract.
Gradually add the dry ingredients to the butter mixture, alternating with the milk. Begin and end with the dry ingredients, mixing well after each addition.
Gently fold in the diced apples and chopped walnuts (if using) into the batter until evenly distributed.
Pour the batter into the prepared loaf tin, spreading it evenly.
Bake in the preheated oven for about 50-60 minutes, or until a toothpick inserted into the centre comes out clean. If the top of the cake is browning too quickly, you can cover it loosely with tin foil during baking.
Once baked, remove the loaf cake from the oven and let it cool in the tin for 10 minutes. Then transfer the cake to a wire rack to cool completely.
Dust the cooled apple loaf cake with powdered sugar before serving.