0

I have code in obj-c

+(id)viewController
{
    UIViewController *vc = [[self alloc]init];
    return vc;
}

But I cannot reproduce this in swift code I try in this way

   class  func viewController()->UIViewController
    {
        return self();
    }
  convenience override  init () {
        var nibName = NSStringFromClass(self.dynamicType) // In this part I get err
        self.init(nibName:nibName,bundle:nil);

    }

I cannot get self class name before init ... in obj-c its look like this

NSString *nibName = NSStringFromClass([self class]);
self = [super initWithNibName:nibName bundle:nil];
UnRewa
  • 2,462
  • 2
  • 29
  • 31
  • Probably related: http://stackoverflow.com/questions/24107658/get-a-user-readable-version-of-the-class-name-in-swift-in-objc-nsstringfromclas – Matthias Bauch Dec 08 '14 at 09:42
  • 1
    not exactly my problems is when I will use this I don't know childer controller name (Thats why I use self) – UnRewa Dec 08 '14 at 09:45

0 Answers0