Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jacobsapps/e395a6c9ef49c53c6887d9eab058b3db to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/e395a6c9ef49c53c6887d9eab058b3db to your computer and use it in GitHub Desktop.
import SwiftData
@Model
final class CardEntity {
@Attribute(.unique) var id: UUID
var title: String
var emoji: String
var hexColor: String
var rarity: String
@Relationship(inverse: \StatEntity.card) var stats: [StatEntity]
var imageData: Data
var createdAt: Date
}
@Model
final class StatEntity {
var name: String
var value: Double
@Relationship var card: CardEntity?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment