---
title: "getToolbarItem(completionHandler:)"
framework: safariservices
role: symbol
role_heading: Instance Method
path: "safariservices/sfsafariwindow/gettoolbaritem(completionhandler:)"
---

# getToolbarItem(completionHandler:)

Gets the extension’s toolbar item from the target window.

## Declaration

```swift
func getToolbarItem(completionHandler: @escaping @Sendable (SFSafariToolbarItem?) -> Void)
```

```swift
func toolbarItem() async -> SFSafariToolbarItem?
```

## Parameters

- `completionHandler`: A block called after the toolbar item is retrieved.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func toolbarItem() async -> SFSafariToolbarItem? For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.
