Preheat the oven to 180°C.
Pulse flour, butter, and egg yolks in a food processor until the mixture resembles breadcrumbs.
Add iced water and pulse until the dough combines, then chill in the fridge.
Blanch the potato slices in boiling salted water for a few minutes.
Fry the sliced onion until soft, then add pancetta and fry until crisp.
Fry the gammon and sage in a separate pan for two minutes, then chop into small pieces.
Layer potatoes, gammon, onions, pancetta, and apples into an ovenproof dish.
Season with pepper and sugar.
Whisk cider, cornflour, and cream together and pour the liquid over the filling.
Roll out the chilled pastry and place it over the filling, crimping the edges.
Cut a hole in the center, brush with beaten egg, and bake for one hour until golden.