Skip to content

Commit 93a0734

Browse files
committed
Add Model.init()
1 parent 9947b62 commit 93a0734

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Sources/CoreModel/Entity.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ public protocol Entity: Identifiable where Self.ID: CustomStringConvertible, Cod
2424
func encode() -> ModelData
2525
}
2626

27+
public extension Model {
28+
29+
init(entities: any Entity.Type...) {
30+
self.init(entities: entities.map { .init(entity: $0) })
31+
}
32+
}
33+
2734
public extension EntityDescription {
2835

2936
init<T: Entity>(entity: T.Type) {

0 commit comments

Comments
 (0)