I am trying to use libmpv in a swift project. I have everything linked up and am trying to follow the basic example.
The problem is, that to show a video, I have to pass an integer pointer (intptr_t) to the wid command. In Objective-C this would be done as the example above hints:
int64_t wid = (intptr_t) self->wrapper;
where wrapper is the wrapper view meant for the video player. However, as swift is not meant to be working with pointers, and the wrapper view is one as I understand, I do not know how to translate this to swift.
I tried casting the NSView to an UnsafePointer
like this
let t = UnsafePointer(&view)
and then cast t
to an intptr_t
or Int
but this conversion does not work. It says this value cannot be converted to the Int
.
So how can I embed the video player in a swift view?