minimumCount(_:)
Enforces a minimum number of elements in the array.
Declaration
static func minimumCount<Element>(_ count: Int) -> GenerationGuide<[Element]> where Value == [Element]Discussion
The bounds are inclusive.
A minimumCount generation guide may be used when you want to ensure the model produces a number of array elements greater than or equal to to some minimum value, such as the number of items in a game’s shop.
@Generable
struct Shop {
@Guide(description: "A creative name for a shop in a fantasy RPG")
var name: String
@Guide(description: "A list of items for sale", .minimumCount(3))
var inventory: [ShopItem]
}