I am new to both Swing and Objective-C and I was trying to work with AVCaptureDevice.
I tried to implement the following code that gives me back a private member of an AVCaptureDevice instance in Objective-C. But I am no able to transfer the same instruction to Swift:
CMIOObjectID connectionID;
AVCaptureDevice *main_cam = (AVCaptureDevice*)[cameras objectAtIndex:0];
connectionID = [main_cam performSelector:NSSelectorFromString(@"connectionID") withObject:nil];
Mainly because the
main_cam.perform(NSSelectorFromString("connectionID"), with: nil)
in Swift returns an
Unmanaged<AnyObject>
and does not accept a forced cast to CMIOObjectID.
Is it possible to perform the operation in Swift?