<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ForEach/init(subviews:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7ForEachV8subviews7contentACyAA0cD17SubviewCollectionVyq0_GAA0G0V2IDVq0_Gqd___q0_AJctcAHRszALRs_AA4ViewR0_AaNRd__lufc"
  },
  "title" : "init(subviews:content:)"
}
-->

# init(subviews:content:)

Creates an instance that uniquely identifies and creates views across
updates based on the subviews of a given view.

```
init<V>(subviews view: V, @ContentBuilder content: @escaping (Subview) -> Content) where Data == ForEachSubviewCollection<Content>, ID == Subview.ID, Content : View, V : View
```

## Parameters

`view`

The view to extract the subviews of.

`content`

The content builder that creates views from subviews.

## Discussion

Subviews are proxies to the resolved view they represent, meaning
that modifiers applied to the original view will be applied before
modifiers applied to the subview, and the view is resolved
using the environment of its container, *not* the environment of the
its subview proxy. Additionally, because subviews must represent a
single leaf view, or container, a subview may represent a view after the
application of styles. As such, attempting to apply a style to it may
have no effect.

---

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)