---
title: "transmit(_:reply:)"
framework: cryptotokenkit
role: symbol
role_heading: Instance Method
path: "cryptotokenkit/tksmartcard/transmit(_:reply:)"
---

# transmit(_:reply:)

Transmits data in Application Protocol Data Unit (APDU) format to the Smart Card.

## Declaration

```swift
func transmit(_ request: Data, reply: @escaping @Sendable (Data?, (any Error)?) -> Void)
```

```swift
func transmit(_ request: Data) async throws -> Data
```

## Parameters

- `request`: The APDU request data.
- `reply`: The NSError object is created in the doc://com.apple.cryptotokenkit/documentation/CryptoTokenKit/TKErrorDomain domain with a code in the doc://com.apple.cryptotokenkit/documentation/CryptoTokenKit/TKError/Code enumeration.

## Discussion

Discussion You should only call this method after a session to the Smart Card has been established using the beginSession(reply:) method, and before the session is terminated using the endSession() method.

## See Also

### Communicating with the Smart Card

- [beginSession(reply:)](cryptotokenkit/tksmartcard/beginsession(reply:).md)
- [endSession()](cryptotokenkit/tksmartcard/endsession().md)
