Preheat the oven to 180°C/160°C fan.
Grease and line a traybake tin approx 12x9" in size.
Sieve the flour into a large bowl. Add the xanthan gum, baking powder, baking soda and salt. Whisk together thoroughly and set aside.
Peel, de-core, weigh out and grate the apples.
Add the butter/spread and sugar to the bowl of an electric mixer. Beat on a medium speed until pale and fluffy (about 4 minutes). You can also do this by hand.
Add one egg, followed by a tablespoon of the flour mixture. Mix on a medium speed (or by hand) until incorporated. Repeat the same process with the other two eggs.
Add the grated apple and cinnamon and mix through thoroughly.
Add the remaining flour mixture and mix gently on a low speed/by hand until just incorporated.
Spoon the mixture into the lined tin and bake for 25-30 minutes or until a skewer comes out clean. If the top starts to brown too much, cover loosely with foil.
Remove from the oven and leave in the tin for approx 10 mins before transferring to a cooling rack. Leave for at least 1 hour before icing.