I'm working in Xcode for the first time in over a decade (coming from VS Code and Zed), so bear with me on this one.
I've just started up a new project and got things running, and I'm adding the following struct to my project:
struct HttpRequest: Codable {
let body: String?
let headers: [String: String]
let id: UUID
let method: HttpMethod
let url: String
}
The UUID type is from Foundation, of course. However, when I hit Ctrl+Space to auto-complete it, it says "Foundation is not imported."
If I hit enter to select that entry, it does not auto-import Foundation, and gives me an error that it "Cannot find type 'UUID' in scope".
I can click that error and it then click "import Foundation" to add the import, but this seems like a lot of effort just to "automatically" add an import that Xcode is already aware I need to add.
On the other hand, I found a number of threads online during my search for answers that suggested I shouldn't even need this import, despite Xcode's insistence.
TL;DR, my questions are: 1) Do I need the Foundation import to use UUID in Swift? and 2) If I do need it, how can I auto-import the Foundation module when I auto-complete the UUID type?