Preheat your oven to 350°F (175°C). Grease and line the loaf pan with parchment paper, leaving some excess paper hanging over the sides for easy removal.
In a medium bowl, whisk together the flour, baking soda, salt, cinnamon, and nutmeg until well combined. Set aside.
In a separate large bowl, combine the softened butter and granulated sugar. Cream them together until the mixture becomes light and fluffy. You can use a whisk or an electric mixer for this step.
Add the eggs to the butter-sugar mixture one at a time, ensuring to beat well after each addition. Stir in the vanilla extract.
Gradually incorporate the dry flour mixture into the wet ingredients, mixing until they are just combined. Avoid overmixing, as it can result in denser bread.
Gently fold in the diced apples and chopped walnuts or pecans (if using) into the batter.
In the prepared loaf pan pour the batter, spreading it evenly.
Bake in the preheated oven for about 50-60 minutes, or until a toothpick inserted into the center of the bread comes out clean.
Once baked, remove the pan from the oven and allow the bread to cool in the pan for about 10 minutes. After that, to cool completely transfer it to a cooling rack.