Skip to content

Instantly share code, notes, and snippets.

@omaralbeik
Created April 7, 2018 21:51
Show Gist options
  • Save omaralbeik/441c57832b760ec02e3dedd4045db193 to your computer and use it in GitHub Desktop.
Save omaralbeik/441c57832b760ec02e3dedd4045db193 to your computer and use it in GitHub Desktop.
extension UITextField {
convenience init(
placeholder: String,
keyboardType: UIKeyboardType = .default,
isSecureTextEntry: Bool = false) {
self.init()
self.placeholder = placeholder
self.keyboardType = keyboardType
self.isSecureTextEntry = isSecureTextEntry
}
}
extension UIButton {
convenience init(
type: UIButtonType = .system,
title: String?,
image: UIImage?) {
self.init(type: type)
self.setTitle(title, for: .normal)
self.setImage(image, for: .normal)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment