Yes, you can compost apples.
Peelings and cores compost down very quickly – when the flesh is exposed to air, it browns and decomposes quickly.
Whole apples take longer though because of the protective peel so if you want them to rot down quicker, cut them into chunks before throwing them in the compost.
Apples, even red ones, are classed as “greens” in the compost heap: if you’ve got a LOT, add alongside “browns” (like dried leaves or cardboard) to keep the compost heap balanced. (Balanced heaps will compost down faster.)
If the apples are only slightly past it, you might still be able to use them for other things. The peelings & cores can also be used to make things too – like jam or cider vinegar.
My nannah who was still in her garden at 96 never put any fallen rotting apples in the compost, her reason was unclear to me, colic or something. Not sure what she meant. Do you know what it might be?