---
title: "hoverEffectGroup(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/customhovereffect/hovereffectgroup(_:)-swift.method"
---

# hoverEffectGroup(_:)

Activates this effect as part of an effect group.

## Declaration

```swift
func hoverEffectGroup(_ group: HoverEffectGroup?) -> some CustomHoverEffect

```

## Parameters

- `group`: The HoverEffectGroup to activate when this view is hovered. If nil, this modifier has no effect.

## Return Value

Return Value A new effect that activates with other effects in the same group.

## Discussion

Discussion You use this method to compose effects that affect multiple views in concert. In the following example, both views’ effects are in the same group. As a result, hovering over either view will activate all effects in the group, causing both views to become fully opaque: struct EffectView: View {     var effectGroup: HoverEffectGroup?

var body: some View {         Color.red             .frame(width: 100, height: 100)             .hoverEffect(                 FadeEffect().hoverEffectGroup(effectGroup)             )         Color.blue             .frame(width: 100, height: 100)             .hoverEffect(                 FadeEffect().hoverEffectGroup(effectGroup)             )     } }

struct FadeEffect: CustomHoverEffect {     func body(content: Content) -> some CustomHoverEffect {         content.hoverEffect { effect, isActive, _ in             effect.opacity(isActive ? 1 : 0.5)         }     } }

## See Also

### Creating custom hover effects

- [hoverEffect(_:in:isEnabled:)](swiftui/customhovereffect/hovereffect(_:in:isenabled:).md)
- [hoverEffect(in:isEnabled:body:)](swiftui/customhovereffect/hovereffect(in:isenabled:body:)-swift.method.md)
- [hoverEffectGroup(id:in:behavior:)](swiftui/customhovereffect/hovereffectgroup(id:in:behavior:)-swift.method.md)
- [hoverEffectDisabled(_:)](swiftui/customhovereffect/hovereffectdisabled(_:).md)
