0

I am converting my obj-c app to Swift. For the purpose of overriding system language preferences I am setting my locale in main.m. Something like this:

int main(int argc, char *argv[])
{
    @autoreleasepool {
    [defaults setObject:@"myweirdlocale" forKey:@"AppleLanguages"];
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

This needs to happen early, before any UIKit method is used. didFinishLaunchingWithOptions in AppDelegate is too late. Since there is no main function in Swift. Is there a chance of doing this in Swift?

Mirek
  • 470
  • 4
  • 18
  • 2
    This might be a better reference: [Subclass UIApplication with Swift](http://stackoverflow.com/questions/24020000/subclass-uiapplication-with-swift). It shows how to replace `@UIApplicationMain` by an explicit `main` function in Swift. – Martin R Dec 15 '15 at 22:25
  • Thanks. I just found it too. I like it better. – Mirek Dec 15 '15 at 22:29

0 Answers0