Monday, 15 June 2015

ios - How to correctly implement a designated initializer in swift? -



ios - How to correctly implement a designated initializer in swift? -

this question has reply here:

implicitly unwrapped optionals in uiviewcontroller init method 4 answers

i have question regarding swift.

i know when create designated initializer in objective-c, may need this(in order load corresponding .xib file):

if ((self = [super initwithnibname:@"ppframeviewcontroller" bundle:nil])) { }

what equivalent in swift. just:

super.init(nibname: "ppframeviewcontroller", bundle: nil)

?

or more?

thanks in advance

for uiviewcontroller designated initializer state:

init(nibname nibname: string?, bundle nibbundle: nsbundle?)

therefore in designated initializer invoke it, after have initialized subclass properties:

// subclass properties initialized super.init(nibname: <name>, bundle: <bundle>) // other initialization

ios objective-c swift

No comments:

Post a Comment