I'm trying to use DiskArbitration and install a first callback function, which is DADiskAppearedCallback, but i am stuck at the DARegisterDiskAppearedCallback statement, with this error:
'DeviceManager' is not convertible to 'UnsafeMutablePointer<()>'
I need to pass a DeviceManager instance to the callback in order to populate the array inside...
Here is my code:
class DeviceManager {
var devices = [Device]()
func diskAppearedCallback(disk: DADisk!, context: UnsafeMutablePointer<()>) {
NSLog("Disk: \(DADiskGetBSDName(disk))")
// Create and Add a device here...
}
var callback = CFunctionPointer<(DADisk!, UnsafeMutablePointer<()>) -> Void>()
init() {
var session = DASessionCreate(kCFAllocatorDefault).takeRetainedValue()
DARegisterDiskAppearedCallback(session, kDADiskDescriptionMatchVolumeMountable, callback, self)
...
}
}
Thank's in advance for any help.