Precondition failed

Good day, I get an error “precondition failed” in this struct, what does this mean and how can I solve it?

struct Item: Identifiable {
    
    // Make sure this ID is unique.
    var id: String {
        date
    }
    
    var date: String
    var interval: String
    var duration: String
    var time: String
}

Thank You

Where do you get the error precisely ? When you create item ? Elsewhere ?

You want id to be unique of course.

You'd better use:

    let id = UUID()
Precondition failed
 
 
Q