For working in iOS, OpenCV provides its usual C++ interface that can be invoked from Objective-C++. In recent years, however, Apple has encouraged iOS application developers to use the more versatile Swift language for building applications and forgo Objective-C. Luckily, a bridge between Swift and Objective-C (and Objective-C++) can be easily created, allowing us to invoke Objective-C functions from Swift. Xcode automates much of the process, and creates the necessary glue code.
To start, we create a new file (Command-N) in Xcode and select Cocoa Touch Class, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781789533576/graphics/assets/8c89ebc3-3218-4110-bebd-a03aef10f76f.png)
Choose a meaningful name for the file (for example, StitchingWrapper) and make sure to select Objective-C as the language, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781789533576/graphics/assets/86342b17-4a57-4e61-8594-c2f5694f7ea9.png)
Next, as shown in the following screenshot, confirm that Xcode should create...