Skip to content

Instantly share code, notes, and snippets.

@kutan74
Created June 4, 2020 12:08
Show Gist options
  • Save kutan74/7145a8e1e0885e33d873f17d73f8f9ba to your computer and use it in GitHub Desktop.
Save kutan74/7145a8e1e0885e33d873f17d73f8f9ba to your computer and use it in GitHub Desktop.
extension UIImageButton {
static func make(withImageIdentifier imageIdentifier: String) -> UIImageButton {
let button = UIImageButton(UIImage(named: imageIdentifier))
return button
}
}
// So that we create an instance like that
let searchButton = UIImageButton.make(withImageIdentifier: "Simple Search Icon")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment