---
title: "TXTRecordGetCount(_:_:)"
framework: dnssd
role: symbol
role_heading: Function
path: "dnssd/txtrecordgetcount(_:_:)"
---

# TXTRecordGetCount(_:_:)

Returns the number of keys stored in the TXT Record.

## Declaration

```swift
func TXTRecordGetCount(_ txtLen: UInt16, _ txtRecord: UnsafeRawPointer!) -> UInt16
```

## Parameters

- `txtLen`: The size of the received TXT Record.
- `txtRecord`: Pointer to the received TXT Record bytes.

## Return Value

Return Value Returns the total number of keys in the TXT Record.

## Discussion

Discussion The count can be used with TXTRecordGetItemAtIndex() to iterate through the keys.

## See Also

### TXT Record Parsing Functions

- [DNSServiceCreateDelegateConnection](dnssd/dnsservicecreatedelegateconnection.md)
- [DNSServiceSetDispatchQueue(_:_:)](dnssd/dnsservicesetdispatchqueue(_:_:).md)
- [TXTRecordContainsKey(_:_:_:)](dnssd/txtrecordcontainskey(_:_:_:).md)
- [TXTRecordGetItemAtIndex(_:_:_:_:_:_:_:)](dnssd/txtrecordgetitematindex(_:_:_:_:_:_:_:).md)
- [TXTRecordGetValuePtr(_:_:_:_:)](dnssd/txtrecordgetvalueptr(_:_:_:_:).md)
