I also got same issue for Xcode 15.0 and swift version is 5.9
To fix this, instead of directly running the command "swift YourFileName.swift", execute the following commands in terminal:
step 1-> swiftc YourFileName.swift (this will generate one executable file in the same folder with same name i.e, "YourFileName"
step 2-> ./YourFileName