Swift 1.2 beta2 and CoreMIDI

Swift Language

Swift 1.2 beta2 and CoreMIDI

Someone is actually working on CoreMIDI with Swift.


Apple has improved Core MIDI support for Swift since this was written.

The Problem

Prior to Swift 1.2, various CoreMIDI types defined in MIDIServices.h were architecture dependent. Like this:

This mean that you had to deal with nonsense like this:

I blogged about the problem with creating a MIDI client ref in a 32-bit architecture. (Hint: don’t try).

Now in Swift 1.2 beta wer get this:

Those Opaque structs are now history. Yay.


Let’s look at the MIDI Services reference.

Here’s a gem. Note the return type.

You would use this like so:

ItemCount is defined in MacTypes. Or it was until now. Right now there is a commment for it but no definition.

Workaround. Go ahead and define it yourself as it was pre-Swift 1.2.

Or just don’t use it.

Table of Contents


There is progress with using CoreMIDI from Swift.
There are still potholes though.


Share These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • Twitter
  • LinkedIn
  • email
  • DZone
  • Slashdot
  • Reddit
  • Google Bookmarks
  • Digg
  • StumbleUpon
  • del.icio.us
This entry was posted in Core MIDI, Swift and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">