0

enter image description here

I want convert the implementation to NSValue, but it's err.

In Objective-C, can use this line to convert:

[NSValue valueWithPointer:implementation]

but in Swift, how to convert?

Robin.Chao
  • 103
  • 9
  • 1
    Why do you need to convert it? – matt Feb 29 '16 at 03:53
  • I want to store the implementation to check something. thanks. – Robin.Chao Feb 29 '16 at 03:56
  • But in Swift you can just store the Imp. That NSValue stuff is just so you can pass the Imp where an ObjectiveC object is expected. But in Swift it's already any object. So why bother converting it? – matt Feb 29 '16 at 04:17

1 Answers1

1

As it says, it needs an UnsafePointer, not a COpaquePointer. So convert it:

let impValue = NSValue(pointer: UnsafePointer(imp))
Rob Napier
  • 286,113
  • 34
  • 456
  • 610