LoginSignup
3
3

More than 5 years have passed since last update.

ObjC to Swift : [[NSViewController alloc] init]

Last updated at Posted at 2015-05-03

Objective-C

ViewController * viewController = [[ViewController alloc] init];
ViewController.m
- (id) init
{
    self = [super initWithNibName: @"nibName"
                           bundle: nil];
    return self;
}

Swift

let viewController = ViewController()
ViewController.swift
override init!( nibName nibNameOrNil: String?,
               bundle nibBundleOrNil: NSBundle? )
{
    super.init( nibName: nibNameOrNil,
                 bundle: nibBundleOrNil )
}

convenience init()
{
    self.init( nibName: "nibName",
                bundle: nil )
}

required init?( coder: NSCoder )
{
    fatalError( "not implemented" )
}

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3