Last active
October 11, 2018 03:29
-
-
Save vialyx/fad211eba1a93ea66f1ad940e1196a02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class FullscreenButton: UIButton { | |
// Convenience initializer | |
convenience init(_ screen: UIScreen) { | |
// Reusing Designated initializer | |
self.init(frame: screen.bounds) | |
} | |
// Initializer overriding | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
} | |
// Required initializer | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
// Failable Initializer | |
init?(_ screen: UIScreen, with type: UIButton.ButtonType) { | |
guard screen.bounds.width > 320 else { return nil } | |
super.init(frame: screen.bounds) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment