---
title: "MIDIClientDispose(_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midiclientdispose(_:)"
---

# MIDIClientDispose(_:)

Disposes of a MIDI client.

## Declaration

```swift
func MIDIClientDispose(_ client: MIDIClientRef) -> OSStatus
```

## Parameters

- `client`: The client to dispose of.

## Return Value

Return Value An OSStatus result code.

## Discussion

Discussion Don’t explicitly dispose of your client; the system automatically disposes all clients when an app terminates. However, if you call this method to dispose the last or only client owned by an app, the MIDI server may exit if there are no other clients remaining in the system. If this occurs, all subsequent calls by your app to MIDIClientCreate(_:_:_:_:) and MIDIClientCreateWithBlock(_:_:_:) fail.

## See Also

### Client management

- [Incorporating MIDI 2 into your apps](coremidi/incorporating-midi-2-into-your-apps.md)
- [MIDIClientCreate(_:_:_:_:)](coremidi/midiclientcreate(_:_:_:_:).md)
- [MIDIClientCreateWithBlock(_:_:_:)](coremidi/midiclientcreatewithblock(_:_:_:).md)
- [MIDIClientRef](coremidi/midiclientref.md)
