<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreHaptics",
  "identifier" : "/documentation/CoreHaptics/CHHapticPattern/init(contentsOf:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Haptics"
    ],
    "preciseIdentifier" : "c:objc(cs)CHHapticPattern(im)initWithContentsOfURL:error:"
  },
  "title" : "init(contentsOf:)"
}
-->

# init(contentsOf:)

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

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

## Parameters

`ahapURL`

A URL to an AHAP file that describes a pattern.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)