Swift Apps

Learn how to add the RevTwo library to your app here.

The RevTwo library has header files that need to be imported into Swift language. To do this, a Swift project needs to have a Bridging Header file.

Here’s a link from Apple and a more practical one from Stack Overflow explaining the Bridging Header.

If your project is named “Twizzle”, you need to create a header file with the name “Twizzle-Bridging-Header.h” and add the following to it:

#import "Revtwo.h";
#import "R2CommunityTableViewController.h"
#import "R2CommunityCallViewController.h"
#import "R2NewTicketViewController.h"

Creating this header file may add it to your project. If it doesn’t, click on the project and select the target, then Build Settings and scroll down to Swift Compiler – Code Generation. Set the property Objective-C Bridging Header to the file, such as “Twizzle/Twizzle-Bridging-Header.h”. Hint – you can drag the header file from the project tree into this setting instead of typing it and possibly making a mistake.

This makes definitions of the RevTwo functions and classes available to Swift.

Objective-C strings are @”string” while Swift just uses “string” like every other language.