This page contains examples of code integration in Objective-C/Swift for iOS.

To integrate the generated code with Swift, a bit of work is required. You can’t drop the header in the bridging header !!!.

Common Integration

The generic way to integrate the generated code is done through an Objective-C class. Other integrations are possible and you are encouraged to have imagination about it.

Create a surrogate class (both header/source files):

#import <Foundation/Foundation.h>

@interface MisleadingNameManager : NSObject

- (void)initializeSetttings; // <= Note that the function's name is misleading on purpose

#import "MisleadingNameManager.h"
#import "receigen.h" // <= This is the header containing the generated code

@implementation MisleadingNameManager

- (void)initializeSetttings {
    ReceiptValidation_CheckReceipt(); // <= Note that the function's name depends on your parameter


The surrogate class allows to wrap the validation code and to avoid nasty linkage errors. Once it is done, add the MisleadingNameManager.h header to the bridging header. It should look like:

//  Use this file to import your target's public headers that you would like to expose to Swift.
#import "MisleadingNameManager.h"

Now you can call the validation code through the surrogate class:

var manager = MisleadingNameManager()

That’s it.