I've imported a Swift UIViewController
in an Objective-C-based project and I've followed
and
My project doesn't crash, but I can't get a view to load. I'm attempting to instantiate a viewController
, but it shows up as a white blank screen:
UIViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"mySwiftVC"];
I put a breakpoint in immediately after the prior line and po rootViewController
gives a memory address.
I threw a println
in the viewDidLoad
of MySwiftVC
, but nothing comes up. All the lights "are on", but nothing displays/executes. Any ideas where to look for resolution?
Here's the method where the prior line was called:
- (void)checkDisclaimer {
UIStoryboard *storyboard = self.window.rootViewController.storyboard;
if ([[[NSUserDefaults standardUserDefaults]valueForKey:@"disclaimerAcknowledged"]boolValue] == NO) {
// set to instantiate disclaimer VC
UIViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"disclaimer"];
self.window.rootViewController = rootViewController;
NSLog(@"Disclaimer IS NOT acknowledged");
} else {
// this is the line that's working from a memory standpoint, but nothing happens
UIViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"launchScreen"];
self.window.rootViewController = rootViewController;
NSLog(@"Disclaimer IS acknowledged");
}
[self.window makeKeyAndVisible];
}