Make the pastry by mixing the flour, margarine and icing sugar in a food processor or mixer until fine and crumbly. Add the egg yolks until the mixture comes together.
Press the dough into a shallow tin and chill for 10 minutes.
Spread the pastry with the jam.
Beat the sugar and the eggs together, then stir in the coconut. Spread over the jam, pressing down with the back of a spoon.
Bake in the preheated oven for 25 – 30 minutes, until lightly golden. Leave to cool cut into pieces and serve.