---
title: "init(archivableObject:uniformTypeIdentifier:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctattachment/init(archivableobject:uniformtypeidentifier:)"
---

# init(archivableObject:uniformTypeIdentifier:)

Creates an attachment from an object that conforms to NSSecureCoding, with a custom UTI.

## Declaration

```swift
convenience init(archivableObject object: any NSSecureCoding, uniformTypeIdentifier identifier: String)
```

## Parameters

- `object`: An encodable object that conforms to doc://com.apple.documentation/documentation/Foundation/NSSecureCoding.
- `identifier`: A custom UTI to represent the encoded data’s type.

## See Also

### Creating Attachments from Objects

- [init(plistObject:)](xctest/xctattachment/init(plistobject:).md)
- [init(archivableObject:)](xctest/xctattachment/init(archivableobject:).md)
