---
title: compositingGroup()
framework: swiftui
role: symbol
role_heading: Instance Method
path: swiftui/view/compositinggroup()
---

# compositingGroup()

Wraps this view in a compositing group.

## Declaration

```swift
nonisolated func compositingGroup() -> some View

```

## Return Value

Return Value A view that wraps this view in a compositing group.

## Discussion

Discussion A compositing group makes compositing effects in this view’s ancestor views, such as opacity and the blend mode, take effect before this view is rendered. Use compositingGroup() to apply effects to a parent view before applying effects to this view. In the example below the compositingGroup() modifier separates the application of effects into stages. It applies the opacity(_:) effect to the VStack before the blur(radius:) effect is applied to the views inside the enclosed ZStack. This limits the scope of the opacity change to the outermost view. VStack {     ZStack {         Text("CompositingGroup")             .foregroundColor(.black)             .padding(20)             .background(Color.red)         Text("CompositingGroup")             .blur(radius: 2)     }     .font(.largeTitle)     .compositingGroup()     .opacity(0.9) }

## See Also

### Compositing views

- [blendMode(_:)](swiftui/view/blendmode(_:).md)
- [drawingGroup(opaque:colorMode:)](swiftui/view/drawinggroup(opaque:colormode:).md)
- [BlendMode](swiftui/blendmode.md)
- [ColorRenderingMode](swiftui/colorrenderingmode.md)
- [CompositorContent](swiftui/compositorcontent.md)
- [CompositorContentBuilder](swiftui/compositorcontentbuilder.md)
- [AnyCompositorContent](swiftui/anycompositorcontent.md)
