<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ForEach/init(_:content:)-ktgx",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7ForEachVAASnySiGRszSiRs_rlE_7contentACyADSiq0_GAD_q0_Sictcfc"
  },
  "title" : "init(_:content:)"
}
-->

# init(_:content:)

Creates an instance that computes views on demand over a given constant
range.

```
@export(implementation) init(_ data: Range<Int>, @ContentBuilder content: @escaping (Int) -> Content)
```

## Parameters

`data`

A constant range.

`content`

The content builder that creates views dynamically.

## Discussion

The instance only reads the initial value of the provided `data` and
doesn’t need to identify views across updates. To compute views on
demand over a dynamic range, use `ForEach/init(_:id:content:)`.

---

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)