Last active
August 29, 2015 14:07
-
-
Save jonfriskics/16ec8e8828ccf641d38a to your computer and use it in GitHub Desktop.
Weird initializer behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ComicViewController: UIViewController, UIScrollViewDelegate { | |
var comicToLoad:NSDictionary | |
/* This is a custom initializer, but it has to call init(nibName, bundle) or there's a compiler error. | |
I get that, because init(nibName, bundle) is the designated initializer, but ... */ | |
init(passedInComic: NSDictionary) { | |
comicToLoad = passedInComic | |
super.init(nibName: nil, bundle: nil) | |
automaticallyAdjustsScrollViewInsets = false | |
} | |
/* ... this also has to be here to avoid a compiler error. | |
I'm not loading any Storyboards -- so why does this have to be here too? */ | |
required init(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment