---
title: Entry()
framework: swiftui
role: symbol
role_heading: Macro
path: swiftui/entry()
---

# Entry()

Creates an environment values, transaction, container values, or focused values entry.

## Declaration

```swift
@attached(accessor) @attached(peer, names: prefixed(__Key_)) macro Entry()
```

## Mentioned in

Building and customizing the menu bar with SwiftUI

## Environment Values

Environment Values Create EnvironmentValues entries by extending the EnvironmentValues structure with new properties and attaching the @Entry macro to the variable declarations: extension EnvironmentValues {     @Entry var myCustomValue: String = "Default value"     @Entry var anotherCustomValue = true } Transaction Values Create Transaction entries by extending the Transaction structure with new properties and attaching the @Entry macro to the variable declarations: extension Transaction {     @Entry var myCustomValue: String = "Default value" } Container Values Create ContainerValues entries by extending the ContainerValues structure with new properties and attaching the @Entry macro to the variable declarations: extension ContainerValues {     @Entry var myCustomValue: String = "Default value" } Focused Values Since the default value for FocusedValues is always nil, FocusedValues entries cannot specify a different default value and must have an Optional type. Create FocusedValues entries by extending the FocusedValues structure with new properties and attaching the @Entry macro to the variable declarations: extension FocusedValues {     @Entry var myCustomValue: String? }

## See Also

### Moving an animation to another view

- [withTransaction(_:_:)](swiftui/withtransaction(_:_:).md)
- [withTransaction(_:_:_:)](swiftui/withtransaction(_:_:_:).md)
- [transaction(_:)](swiftui/view/transaction(_:).md)
- [transaction(value:_:)](swiftui/view/transaction(value:_:).md)
- [transaction(_:body:)](swiftui/view/transaction(_:body:).md)
- [Transaction](swiftui/transaction.md)
- [TransactionKey](swiftui/transactionkey.md)
