In Swift I am trying to create an AUSamplerBankPresetData object which requires an Unmanaged<CFURL> object.
How do I convert a URL object into Unmanaged<CFURL> in swift?
You first need to convert your URL into a CFURL. This can be done with an unconditional cast so:
let cfurl = url as CFURL
Then, to create an unmanaged reference to that CFURL you'll need to use one of the functions outlined here to create an Unmanaged object. Make sure you choose the right one for your application. The example below will increment the reference count, so you will need to make sure that it is decremented later.
var um = Unmanaged<CFURL>.passRetained(cfurl)
passRetained() increases the refcount, so this must be balanced eventually to avoid a memory leak.