I have a class in Obj-C, it can only be initialized by calling +new, and -init is not supported:
@interface SetupMainController : UIViewController
+(SetupMainController *)new;
-(id)init __attribute__((unavailable("Must use +new")));
@end
I am trying to run the following equivalent obj-c code in swift:
SetupMainController *setupController = [SetupMainController new];
[self presentViewController:setupController animated:YES completion:nil];
like so:
let sc : SparkSetupMainController = SparkSetupMainController.new()
or:
let sc : SparkSetupMainController.new()
or:
let sc : SparkSetupMainController()
(which obviously tries to call -init which is prohibited) all fails, getting "expected member name following '.'" error.
I found answers like this or this or apple docs but none give a straight answer how to do that simple task in Swift.
Help appriciated
return [[SetupMainController getSetupStoryboard] instantiateViewControllerWithIdentifier:@"root"];functiongetSetupStoryboardis a class method as well, loading the relevant storyboard from the bundlesetupViewControllerFromStoryboard.setupViewControllerFromStoryboard(), how do I call that from swift?