Skip to content

Instantly share code, notes, and snippets.

@jonfriskics
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonfriskics/16ec8e8828ccf641d38a to your computer and use it in GitHub Desktop.
Save jonfriskics/16ec8e8828ccf641d38a to your computer and use it in GitHub Desktop.
Weird initializer behavior
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