<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioSession/setCategory(_:mode:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioSession(im)setCategory:mode:options:error:"
  },
  "title" : "setCategory(_:mode:options:)"
}
-->

# setCategory(_:mode:options:)

Sets the audio session’s category, mode, and options.

```
func setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode, options: AVAudioSession.CategoryOptions = []) throws
```

## Parameters

`category`

The category to apply to the audio session. See [`AVAudioSession.Category`](/documentation/AVFAudio/AVAudioSession/Category-swift.struct) for supported category values.

`mode`

The audio session mode to apply to the audio session. For a list of values, see [`AVAudioSession.Mode`](/documentation/AVFAudio/AVAudioSession/Mode-swift.struct).

`options`

A mask of additional options for handling audio. For a list of constants, see [`AVAudioSession.CategoryOptions`](/documentation/AVFAudio/AVAudioSession/CategoryOptions-swift.struct).

## Discussion

The audio session’s [`category`](/documentation/AVFAudio/AVAudioSession/category-swift.property) and [`mode`](/documentation/AVFAudio/AVAudioSession/mode-swift.property) together define how your app uses audio. Typically, you set the category and mode before activating the session. You can also set the category or mode while the session is active, but doing so results in an immediate change.

---

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)