- Posts: 2
- Joined: Tue Oct 18, 2016 1:08 am
I found the following reference which may help with your integration [1].
Based on a comment in that document "You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code." it is my understanding that you will likely need to develop an Objective-C wrapper around the DeckLink API, and then use this wrapper via a bridging header in Swift.
The usage of the DeckLink API in your wrapper will be the same as with any other DeckLink API based application. To this end, I recommend reviewing SDK manual chapters "2.4.1 Capture", & "2.4.2 Playback" for a high-level overview of the steps required to perform a capture or playback operation.
1) What does "#import <list>" do? I can't find any documentation for it online. Does it have anything to do with the different versions provided in the SDK?
The #import directive was added to Objective-C as an improved version of #include. Whether or not it's improved, however, is still a matter of debate. #import ensures that a file is only ever included once so that you never have a problem with recursive includes. However, most decent header files protect themselves against this anyway, so it's not really that much of a benefit.
2) Are the only files I need to import the BMDSwitcherAPI.h and BMDSwitcherAPIDispatch.cpp, or do I need other files as well? I only ask because Swift is struggling to understand the use of "class" in BMDSwitcher.h, as I believe it is looking for @interface and @implementation, which is more common for objective-c.
Usually importing DeckLinkAPI.h is enough but depends on which part of the API you are looking to use.
3) In general, has anyone had any luck getting this working in Swift? I can't even run the sample projects because Xcode 8.0 can't compile the code, and I don't know enough old-style objective-c to fix it.
Technically it is possible but not sure whether some one have done this.
[1] https://developer.apple.com/library/ios ... TP40014216