Contents

minimum(_:)

Enforces a minimum value.

Declaration

static func minimum(_ value: Decimal) -> GenerationGuide<Decimal>

Discussion

Use a minimum generation guide — whose bounds are inclusive — to ensure the model produces a value greater than or equal to some minimum value. For example, you can specify that all characters in your game start at level 1:

@Generable
struct GameCharacter {
    @Guide(description: "A creative name appropriate for a fantasy RPG character")
    var name: String

    @Guide(description: "A level for the character", .minimum(1))
    var level: Int
}

See Also

Getting the minimum value