In 2023 the answer is similar but different:
Xcode > Preferences
Platforms Tab
Click the lower left hand + button
Select the versions you want to download.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: