Uuid variable name taken?

In trying to setup a struct of type identifiable, I attempted to set " var uuid:UUID = UUID()" to conform to the Identifiable protocol.

I received the error - Type 'Entries' does not conform to protocol 'Identifiable'.

I changed the var name from "uuid" to "id" and this solved my problem.

So my question is, is uuid used elsewhere? I know that UUID is a structure in the swift library, but lowercase doesn't appear to be taken, so why did I get this error when attempting to use it? Thank you in advance.

Nothing wrong with the name "uuid" it's just that Identifiable requirement is named "id":

public protocol Identifiable<ID> {
    associatedtype ID : Hashable
    var id: Self.ID { get }
}

If you prefer the name to be "uuid" you could still have it:

struct S: Identifiable {
    var id: UUID { uuid }
    var uuid = UUID()
    ...
}
4 Likes

Oh ok! Thank you!