3

How do I initialize Pixate Freestyle on iOS using Swift?

The documentation say to do

int main(int argc, char *argv[])
{
    @autoreleasepool {
        [PixateFreestyle initializePixateFreestyle];
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

How do I do that with Swift?

djunod
  • 4,876
  • 2
  • 34
  • 28

1 Answers1

5

In AppDelegate.swift, comment out or remove:

//@UIApplicationMain

Create a main.swift that contains:

import Foundation
import UIKit

// Override point for customization after application launch.
PixateFreestyle.initializePixateFreestyle()
UIApplicationMain(C_ARGC, C_ARGV, nil, NSStringFromClass(AppDelegate))

For XCode 6.3 and higher replace the UIApplicationMain line with:

UIApplicationMain(Process.argc, Process.unsafeArgv, nil, NSStringFromClass(AppDelegate))

And for Cocoapod-based installs (at least) remember to create (and configure in the target Build Settings) a bridging header with the correct import line:

#import <PixateFreestyle/PixateFreestyle.h>
ase
  • 13,231
  • 4
  • 34
  • 46
djunod
  • 4,876
  • 2
  • 34
  • 28