Xcode 15 Beta 7 1. In expansion of macro '_PersistedProperty' here

My Code was working fine with Beta 6. After updating Beta 7. it throws following error

Return from initializer without initializing all stored properties

@Model public class Product {
   public var id:UUID
   public var name: String
   //relationship
   public var category:Category!  //1. In expansion of macro '_PersistedProperty' here

public init(id:UUID, name: String){
      self.id = id
      self.name = name
}
Answered by macrojd in 762974022

In Beta 7, all the properties need a default value or be optional.

@Model public class Product {
   public var id:UUID = UUID()
   public var name: String = ""
   //relationship
   public var category:Category?

public init(name: String){
      self.name = name
}

Accepted Answer

In Beta 7, all the properties need a default value or be optional.

@Model public class Product {
   public var id:UUID = UUID()
   public var name: String = ""
   //relationship
   public var category:Category?

public init(name: String){
      self.name = name
}

Xcode 15 Beta 7 1. In expansion of macro '_PersistedProperty' here
 
 
Q