---
title: "overlay(_:alignment:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/overlay(_:alignment:)"
---

# overlay(_:alignment:)

Layers a secondary view in front of this view.

## Declaration

```swift
nonisolated func overlay<Overlay>(_ overlay: Overlay, alignment: Alignment = .center) -> some View where Overlay : View

```

## Parameters

- `overlay`: The view to layer in front of this view.
- `alignment`: The alignment for overlay in relation to this view.

## Mentioned in

Building layouts with stack views

## Return Value

Return Value A view that layers overlay in front of the view.

## Discussion

Discussion When you apply an overlay to a view, the original view continues to provide the layout characteristics for the resulting view. In the following example, the heart image is shown overlaid in front of, and aligned to the bottom of the folder image. Image(systemName: "folder")     .font(.system(size: 55, weight: .thin))     .overlay(Text("❤️"), alignment: .bottom)

## See Also

### Appearance modifiers

- [colorScheme(_:)](swiftui/view/colorscheme(_:).md)
- [listRowPlatterColor(_:)](swiftui/view/listrowplattercolor(_:).md)
- [background(_:alignment:)](swiftui/view/background(_:alignment:).md)
- [foregroundColor(_:)](swiftui/view/foregroundcolor(_:).md)
- [complicationForeground()](swiftui/view/complicationforeground().md)
