---
title: "withID(_:attributeElement:)"
framework: IOBluetooth
role: symbol
role_heading: Type Method
path: "iobluetooth/iobluetoothsdpserviceattribute/withid(_:attributeelement:)"
---

# withID(_:attributeElement:)

Creates a new service attribute with the given ID and data element.

## Declaration

```swift
class func withID(_ newAttributeID: BluetoothSDPServiceAttributeID, attributeElement: IOBluetoothSDPDataElement!) -> Self!
```

## Parameters

- `newAttributeID`: The attribute ID of the new service attribute.
- `attributeElement`: The data element of the new service attribute.

## Return Value

Return Value Returns the newly allocated service attribute object. Returns nil if there was an error. The returned IOBluetoothSDPDataElement object has been autoreleased, so it is not necessary for the caller to release it. If the object is to be referenced and kept around, retain should be called.
