I had the same problem. Fixed it by updating my mac to Sonoma 14.7.1, after that opened xcode and 18.1 was available for download.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: