<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/GenerationGuide",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels15GenerationGuideV"
  },
  "title" : "GenerationGuide"
}
-->

# GenerationGuide

Guides that control how values are generated.

```
struct GenerationGuide<Value>
```

## Topics

### Getting the pattern

[`static func pattern<Output>(Regex<Output>) -> GenerationGuide<String>`](/documentation/FoundationModels/GenerationGuide/pattern(_:))

Enforces that the string follows the pattern.

### Getting the element

[`static func element<Element>(GenerationGuide<Element>) -> GenerationGuide<[Element]>`](/documentation/FoundationModels/GenerationGuide/element(_:))

Enforces a guide on the elements within the array.

### Getting the count

[`static count(_:)`](/documentation/FoundationModels/GenerationGuide/count(_:))

Enforces that the array has exactly a certain number of elements.

### Getting the constant

[`static func constant(String) -> GenerationGuide<String>`](/documentation/FoundationModels/GenerationGuide/constant(_:))

Enforces that the string be precisely the given value.

[`static func anyOf([String]) -> GenerationGuide<String>`](/documentation/FoundationModels/GenerationGuide/anyOf(_:))

Enforces that the string be one of the provided values.

### Getting a range

[`static range(_:)`](/documentation/FoundationModels/GenerationGuide/range(_:))

Enforces values that fall within a range.

### Getting the minimum value

[`static minimum(_:)`](/documentation/FoundationModels/GenerationGuide/minimum(_:))

Enforces a minimum value.

[`static func minimumCount<Element>(Int) -> GenerationGuide<[Element]>`](/documentation/FoundationModels/GenerationGuide/minimumCount(_:))

Enforces a minimum number of elements in the array.

### Getting the maximum value

[`static maximum(_:)`](/documentation/FoundationModels/GenerationGuide/maximum(_:))

Enforces a maximum value.

[`static func maximumCount<Element>(Int) -> GenerationGuide<[Element]>`](/documentation/FoundationModels/GenerationGuide/maximumCount(_:))

Enforces a maximum number of elements in the array.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)