Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
//Regular function
func fillScreen() {
if let animal = self.selectedAnimal {
self.animalImageView.image = UIImage.init(named: animal.image)
self.animalNameLabel.text =
//Function with alias on parameter
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
//Class function
class AnimalsFactory {
class func createAnimals() -> [Animal] {
var animalsArray: [Animal] = []
for (name, image) in animalsAndImages {
let animal = Animal(name: name, image: image)
return animalsArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.