<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/TaskLocal/get()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:12_Concurrency9TaskLocalC3getxyF"
  },
  "title" : "get()"
}
-->

# get()

Gets the value currently bound to this task-local from the current task.

```
@abi(final func get_aeic() -> Value) final func get() -> Value
```

## Discussion

If no current value binding is available in the context where this call is made,
or if the task-local has no value bound, this will return the `defaultValue`
of the task local.

A task local value may still be bound and read even without a Swift concurrency
task present, as the underlying storage will fallback to using a managed thread-local value
when no task is available. From the perspective of task local APIs, the presented semantics
remain exactly the same as when a task is present.

---

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)