2

My problem is simple, but tricky. I want to write this line

AUPreset *aPreset = (AUPreset*)CFArrayGetValueAtIndex(mEQPresetsArray, indexPath.row);

in Swift. The trick is that the return value is UnsafePointer<Void>.

Willeke
  • 14,578
  • 4
  • 19
  • 47
Vanya
  • 4,973
  • 5
  • 32
  • 57

2 Answers2

2

Here's the Swift 4 version

let aPreset = unsafeBitCast(CFArrayGetValueAtIndex(mEQPresetsArray, indexPath), to: AUPreset.self)
John Stephen
  • 7,625
  • 2
  • 31
  • 45
0

Have you tried this?:

    let aPreset = UnsafePointer<AUPreset>(CFArrayGetValueAtIndex(mEQPresetsArray, indexPath.row))
OOPer
  • 47,149
  • 6
  • 107
  • 142