I keep getting this error message and can't understand why. The object (struct) it is instantiating is and Identifiable struct.
func parseJSON(_ dosageData: Data) -> DoseModel? {
do {
let json = try JSON(data: dosageData)
let date = json["date"].stringValue
let medicine = json["medicine"].stringValue
let units = json["units"].doubleValue
let value = json["value"].stringValue
let dose = DoseModel(id: UUID(), --- Error Line ----
date: date,
medicine: medicine,
units: units,
value: value)
return dose
} catch {
delegate?.didFailWithError(error: error)
return nil
}
}
Model
struct DoseModel: Identifiable {
var id: ObjectIdentifier
var date: String
var medicine: String
var units: String
var value: String
}