---
title: "init(contentsOf:)"
framework: corehaptics
role: symbol
role_heading: Initializer
path: "corehaptics/chhapticpattern/init(contentsof:)"
---

# init(contentsOf:)

Creates a haptic pattern with the contents of an AHAP file.

## Declaration

```swift
init(contentsOf ahapURL: URL) throws
```

## Parameters

- `ahapURL`: A URL to an AHAP file that describes a pattern.

## See Also

### Creating a Haptic Pattern

- [init(events:parameterCurves:)](corehaptics/chhapticpattern/init(events:parametercurves:).md)
- [init(events:parameters:)](corehaptics/chhapticpattern/init(events:parameters:).md)
- [init(dictionary:)](corehaptics/chhapticpattern/init(dictionary:).md)
- [CHHapticPattern.Key](corehaptics/chhapticpattern/key.md)
